跳至主要內容

API 群发

大约 4 分钟

API 群发

新建群发任务接口

  • 类型

    API

  • URI

    /wscrm-bus-api/open/sender/batchAdd

  • 请求方式

    POST、Content-Type: application/json

  • 接口说明

    新建一个群发任务

  • 请求参数说明

字段类型是否必填备注
tenantIdLong公司 id
userNameString管理员账号
tokenStringtoken
createTimeString创建时间
infoobject详情数据

info 参数说明

字段类型是否必填备注
agentAccountString坐席账号
whatsIdString客服号(默认从坐席账号正在登录的客服号执行)
taskTypeString群发类型 1、客户 2、群
friendWhatsIdsString接收人 whatsapp 或群名称
sendDataobject发送内容
startIntervalobject间隔下限时间(默认 1s)
endIntervalobject间隔下限时间(默认 1s)

sendData 参数说明

字段类型是否必填备注
contentString发送内容
contentIndexFieldString发送内容变量集合
sendIndexint发送内容顺序(0~9)
fileobject发送的文件信息
sendTypeint发送类型 1 内容 2 文件

file 参数说明

字段类型是否必填备注
fileUrlString发送的文件 url
fileTypeint-1 其他 2 图片 3 音频 4 文件

contentIndexField 参数说明

字段类型是否必填备注
indexint变量索引位置
fieldTypeint0、基本属性 1、扩展字段(后台配置)
fieldNameString字段名称
字段描述
Name姓名
Gender性别
DOB生日
WhatsApp客服号
Address地址
Email邮箱
Position职业
Income收入
Description说明
From来源
State阶段
Language语言
Tags标签
  • 请求示例:
{
  "tenantId": 520323,
  "userName": "dijia",
  "token": "c1186310d98ab8daa53fcf2e9d03e8f4",
  "createTime": "2021-03-08 14:25:00",
  "info": {
    "agentAccount": "dijia",
    "whatsId": "",
    "taskType": 1,
    "friendWhatsIds": ["919448767724", "33753875029"],
    "startInterval": 10,
    "endInterval": 10,
    "sendData": [
      {
        "sendIndex": 1,
        "file": {
          "fileUrl": "http://download.socialepoch.com/test/whatsapp.png",
          "fileType": 1
        },
        "sendType": 2
      },
      {
        "content": " {0} 你好,你的订单号: 。生日{0},手机号{2},性别{3},地址{4},邮箱{5},职业{6},收入{7},备注{8},来源:{9},阶段:{10}",
        "contentIndexField": [
          {
            "index": 0,
            "fieldType": 0,
            "fieldName": "Name"
          },
          {
            "index": 1,
            "fieldType": 0,
            "fieldName": "DOB"
          },
          {
            "index": 2,
            "fieldType": 0,
            "fieldName": "WhatsApp"
          },
          {
            "index": 3,
            "fieldType": 0,
            "fieldName": "Gender"
          },
          {
            "index": 4,
            "fieldType": 0,
            "fieldName": "Address"
          },
          {
            "index": 5,
            "fieldType": 0,
            "fieldName": "Email"
          },
          {
            "index": 6,
            "fieldType": 0,
            "fieldName": "Position"
          },
          {
            "index": 7,
            "fieldType": 0,
            "fieldName": "Income"
          },
          {
            "index": 8,
            "fieldType": 0,
            "fieldName": "Description"
          },
          {
            "index": 9,
            "fieldType": 0,
            "fieldName": "From"
          },
          {
            "index": 10,
            "fieldType": 0,
            "fieldName": "State"
          }
        ],
        "sendIndex": 0,
        "sendType": 1
      }
    ]
  }
}
  • 响应参数说明
字段名称类型描述
codeint
messageString
dataObject
  • 响应示例:
{
  "code": 200,
  "message": "Success",
  "data": "00126173573c4952bef5d06a2cfbb131"
}

查询群发任务执行接口

  • 类型

    API

  • URI

    /wscrm-bus-api/open/sender/record

  • 请求方式

    POST、Content-Type: application/json

  • 接口说明

    查询任务拆分结果及执行结果

  • 请求参数说明

字段类型是否必填备注
tenantIdLong公司 id
userNameString管理员账号
tokenStringtoken
createTimeString创建时间
infoString详情数据
  • 请求示例
{
  "tenantId": 520274,
  "userName": "lsl001",
  "token": "3024dc308f4cf09a33fdbd47218865cb",
  "createTime": "2021-03-08 14:25:00",
  "info": "00126173573c4952bef5d06a2cfbb131"
}
  • 响应参数说明
字段名称类型描述
codeint
messageString
dataObject

data 参数说明

字段类型是否必填备注
recordIdString任务详情唯一标识
whatsIdString指定客服号/分配执行的客户号
friendWhatsIdString好友 whatsapp/群名称
statusint执行结果 0 未发送 1 已发送 2 已读 3 已读已回 4.已读未回
executeTimeString发送时间(默认'1970-01-01 08:00:01')
chatTypeint群发类型 1 客户 2 群
  • 响应示例
{
  "code": 200,
  "message": "Success",
  "data": {
    "taskId": "07c7d605d09e4ac89be39c53edac628e",
    "recordList": [
      {
        "recordId": "7337",
        "whatsId": "18217331410",
        "friendWhatsId": "8618217331412",
        "chatType": 2,
        "status": 0,
        "executeTime": "1970-01-01 08:00:01"
      },
      {
        "recordId": "7338",
        "whatsId": "18217331410",
        "friendWhatsId": "8618217331411",
        "chatType": 2,
        "status": 0,
        "executeTime": "1970-01-01 08:00:01"
      }
    ]
  }
}

群发任务执行结果通知

  • 配置 ID <GS_SYNC_TASK_STATUS>

  • 类型

    Webhook

  • URI

  • 请求方式

    POST、Content-Type: application/json

  • 说明

    未执行的结果不同步,超过 24 小时不执行,视为超时后同步结果。

  • 请求参数说明:

字段类型是否必填备注
accessTokenString签名字符串 token
callBackUrlString回调地址(post 请求)
tenantIdlong公司 id
timestamplong毫秒时间戳
datalist格式[{},{}],详细如下(数量 0-50 条)

data 参数说明

字段类型是否必填备注
recordIdString详情数据唯一标识
taskIdString任务唯一标识
agentAccountString坐席登录账号
whatsIdString指定客服号/分配执行的客户号
friendWhatsIdString好友 whatsapp
sendInfoListlist发送内容
executeStatusString执行结果 0、未执行 1、成功 2、超时
executeTimeString发送时间

sendList 参数说明

备注:sendList 最少一条信息,上限 10 条,单条中 content 和 fileUrl 存在一个。

字段类型是否必填备注
contentString发送内容
contentIndexFieldString发送内容变量集合
sendIndexint发送内容顺序(0~9)
fileObject发送的文件信息
sendTypeint发送类型 1 内容 2 文件

contentIndexField 参数说明

字段类型是否必填备注
indexint变量索引位置
fieldTypeint0、基本属性 1、扩展字段(后台配置)
fieldNameString字段名称

file 参数说明

字段类型是否必填备注
fileUrlString文件 url
fileTypeint文件类型 -1 其他 1 图片 2 视频 3 音频 4 文件
{
  "tenantId": 123456,
  "userName": "yunyingbao",
  "accessToken": "e6e18763d8212d26ced4f92512881c63c468d5a756d45c01486d7ad6742152ac",
  "callBackUrl": "xxxxx/wscrm-bus-api/xxxxx",
  "timestamp": "1667295870936",
  "data": [
    {
      "recordId": "006c3c67342449ed93c26f3324b4859d",
      "taskId": "00c88c23496b440aac1bc81229a160ef",
      "tenantId": 123456,
      "agentAccount": "yunyingbao",
      "whatsId": "23931231",
      "friendWhatsId": "8617121221512",
      "sendList": [],
      "executeStatus": 1,
      "executeTime": "2023-04-21 14:28:00"
    }
  ]
}
  • 响应参数说明
字段名称类型描述
codeint
messageString
dataList
  • 响应示例
{
  "code": 200,
  "message": "Success",
  "data": ""
}
上次编辑于:
贡献者: kubrick,kubrick,songjun,zhangzhuangzhuang,罗英杰