Skip to content

SAAS saas_plat openapi batch_create

zjc1750514326 edited this page Apr 3, 2023 · 29 revisions

批量创建客户

批量创建客户

  • URL:https://api.nxcloud.com/saas_plat/openapi/batch_create
  • Method:POST
  • Content-Type:application/json
  • 需要鉴权:

鉴权机制

鉴权规则请参考地址:API接口调用约定

请求参数

header参数:

参数名 类型 必选 示例值 说明
accessKey String fme2na3kdi3ki 用户身份标识
ts String 1655710885431 当前请求的时间戳(单位是毫秒),牛信服务端允许用户端请求最大时间误差为60秒
bizType String 2 WhatsApp业务类型,取固定值“2”
action String mt WhatsApp业务操作,取固定值“mt”
sign String 6e9506557d1f289501d333ee2c365826 API入参参数签名,签名算法

body参数:

参数名 类型 必选 示例值 说明
type integer 1 0:放弃旧数据,使用新数据 1:基于旧数据更新/增加数据项目 2:保留旧数据、放弃新数据
tenant_id integer 123 租户id
customers array whatsapp 批量创建,单次限制100
first_name String First Name最大长度为128字符
last_name String Last Name最大长度为128字符
sms_phone String 手机号码最大长度为30字符
whats_app_phone String WhatsApp最大长度为30字符
country String 国家 最大长度为50字符
email String 邮箱最大长度为50字符
address String 街道最大长度为100字符
birthday String 生日 yyyy-MM-dd
source String 来源最大长度50个字符
tags array[integer] 标签ID列表
remark String remark 最大长度100个字符
time_zone String 时区
gender integer 性别,1男, 0 女
customize_field String 自定义字段数据

消息类型

模板消息参数:

参数名 类型 必选 示例值 说明
template JsonObject 参照请求示例 模板消息内容,type=template必填
  • customers参数:
参数名 类型 必选 示例值 说明
first_name String First Name最大长度为128字符
last_name String - Last Name最大长度为128字符
sms_phone String - 手机号码最大长度为30字符
whats_app_phone String - WhatsApp最大长度为30字符
country String - 国家 最大长度为50字符
email String - 邮箱最大长度为50字符
address String - -
birthday String - 生日 yyyy-MM-dd
source String - 来源最大长度50个字符

name | String | 是 | - | 模板名称。 language | JsonObject | 是 | - | 模板语言设置信息。 components | array[component JsonObject] | 否 | - | 模板内组件的变量设置信息序列。

  • language object参数:
参数名 类型 必选 示例值 说明
code String - 语言代码,参照支持的模板语言
policy String - 固定值为deterministic。
  • component object参数:
参数名 类型 必选 示例值 说明
type String - 组件类型,可以是header,body
1)当type=header时,设置模板头部的变量信息;
2)当type=body时,设置模板内容的变量信息;
parameters array[parameter JsonObject] - 组件参数列表。
  • parameter object参数:
参数名 类型 必选 示例值 说明
type String - 其中:
1)当component object的 type=header时,可以为image;
2)当component object的 type=body时,取值为text;
text String - 仅type= text时为必须,设置对应参数的文本内容。type为其它类型时无该项
image JsonObject - 仅type= image时为必须,设置对应参数的图片内容,image object定义参照图片消息。type为其它类型时无该项
  • image object参数:
参数名 类型 必选 示例值 说明
link String - 图片的URL链接。必须是 HTTP/HTTPS URLs。

请求示例

模板消息请求示例

  • 模板消息(参数模板消息)

body(application/json) 参数:

{
    "appkey": "f543ertg",
    "business_phone": "185xxxx8399",
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": "86136xxxx9759",
    "type": "template",
    "template": {
		"name": "text_template",
		"language": {
			"code": "en_US",
			"policy": "deterministic"
		},
		"components": [
                        {
				"type": "header",
				"parameters": [{
					"type": "image",
					"image": {
						"link": "https://imglink"
					}
				}]
			}
			{
				"type": "body",
				"parameters": [
					{
						"type": "text",
						"text": "David"
					},
					{
						"type": "text",
						"text": "B520"
					}
				]
			}
		]
	}
}

响应参数

参数名 类型 说明
code Integer 结果编码
data JsonObject 请求结果
message String 请求结果说明
traceId String 链路追踪ID
  • data object参数:
参数名 类型 说明
message_id String 消息ID

响应示例

成功示例

{
	"code": 0,
	"message": "",
	"data": {
		"message_id": "gBGGhSNXV1dfAglVQ0RRuE3YWhc"
	},
	"traceId": "56bf81643292cd6a89ecde64ae00db13"
}

响应码说明

code message 解决办法
0 请求成功
-1 请求失败 请联系技术人员排除问题
1000~100X 鉴权问题 详情查看API鉴权部分
21058 参数异常 tenant_id 必填
21059 参数异常 app_key 必填
21060 参数异常 business_phone 必填
21061 参数异常 to (接受方号码) 必填
21062 参数异常 type 必填,可选值[template]
21063 参数异常 template 必填
22020 业务异常 客户不存在
22041 业务异常 云平台发送失败
22042 业务异常 发送WhatsApp信息失败
22049 业务异常 business_phone={0}的商户不存在
22089 业务异常 号码不可用(No Core App)
22090 业务异常 非法的号码
22091 业务异常 非WhatsApp用户
22092 业务异常 不存在语言包: {0}
22093 业务异常 模板不存在
22123 业务异常 商户手机号错误
22124 业务异常 应用不存在/不可用
22122 业务异常 应用没有对应国家报价
22125 业务异常 账号余额不足
22126 业务异常 该whatsapp号码未绑定应用

模板语言

语言 代码   语言 代码   语言 代码
Afrikaans af   Greek el   Portuguese (BR) pt_BR
Albanian sq   Gujarati gu   Portuguese (POR) pt_PT
Arabic ar   Hebrew he   Punjabi pa
Azerbaijani az   Hindi hi   Romanian ro
Bengali bn   Hungarian hu   Russian ru
Bulgarian bg   Indonesian id   Serbian sr
Catalan ca   Irish ga   Slovak sk
Chinese (CHN) zh_CN   Italian it   Slovenian sl
Chinese (HKG) zh_HK   Japanese ja   Spanish es
Chinese (TAI) zh_TW   Kannada kn   Spanish (ARG) es_AR
Croatian hr   Kazakh kk   Spanish (SPA) es_ES
Czech cs   Korean ko   Spanish (MEX) es_MX
Danish da   Lao lo   Swahili sw
Dutch nl   Latvian lv   Swedish sv
English en   Lithuanian lt   Tamil ta
English (UK) en_GB   Macedonian mk   Telugu te
English (US) en_US   Malay ms   Thai th
Estonian et   Marathi mr   Turkish tr
Filipino fil   Norwegian nb   Ukrainian uk
Finnish fi   Persian fa   Urdu ur
French fr   Polish pl   Uzbek uz
German de         Vietnamese vi

简介

短信

语音

云呼叫中心(NXLink)

云呼叫中心(AI自动外呼)

Flash Call

短链

邮件验证码

DID号码

通用

号码检测

WhatsApp

Viber

Zalo ZNS

Super Message API

隐私号(旧)

PNS

坐席(旧版)

AI Agent

Clone this wiki locally