You need to enable JavaScript to run this app.
最新活动
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们
导航

短信状态报告回调

最近更新时间2023.07.31 12:33:16

首次发布时间2023.01.17 16:24:55

您可以在短信服务控制台的回执配置中设置回调 URL,接收短信服务异步返回的短信状态报告,以确认短信发送是否成功。

注意事项

回调地址需要符合以下条件,才可以成功接收短信服务发送的短信状态报告。

  • 使用 HTTP/HTTPS URL。

  • 短信服务可以直接访问回调地址,即回调地址具备公网访问能力。

  • 如果回调地址所在服务器设置了防火墙,请放行来自短信服务的请求。

准备工作

在您接收短信服务的回调消息之前,需要登录短信服务控制台配置用于接收回调消息的 URL。

  1. 登录短信服务控制台

  2. 在左侧导航栏,选择通用管理 > 回执配置

  3. 回执配置页面,编辑默认状态报告地址

    设置您用于接收回调消息的 URL。URL 格式为http(s)://<您的回调地址>

在短信服务控制台设置回调地址后,如果您调用 SendSms 接口发送短信,则短信服务会异步向回调地址返回短信状态报告。

回调请求说明

当短信服务返回短信状态报告时,会向回调地址发送 POST 请求。本章节介绍请求 Header 和 Body 包含的参数说明。

参数取值描述
Content-Typeapplication/json;charset=utf-8定义网络文件的类型和网页的编码。
Accept-Encodinggzip, deflate采用指定的压缩格式传输数据。
Accept*/*指定客户端希望接收的数据类型。

Body

请求体整体是一个 JSON 数组。

参数类型描述
accountstring火山引擎账号
sub_accountstring消息组ID
status_codestring发送状态,"0"代表成功,其余表示失败
descriptionstring状态描述
signaturestring签名
template_idstring模板ID
mobilestring手机号
channel_typestring短信类型,可能值:CN_OTP
message_idstring发送时返回的meassage_id字段
msg_countint拆分条数
service_idstring发送通道,非必传,国际/港澳台短信没有该字段
extstring发送时传递的Tag字段
send_timeint64短信发送时间,milliseconds时间戳
recv_timeint64短信接收时间,milliseconds时间戳
mccmncstring移动网络提供者唯一代码
iso_codestringISO 3166-1 国家代码

回调结果示例

[
  {
    "account": "200****",
    "sub_account": "1504****",
    "signature": "短信服务",
    "mobile": "188******",
    "channel_type": "CN_OTP",
    "service_id": "106966940****",
    "send_time": 1669171012444,
    "template_id": "SPT_0fa7****",
    "ext": "123456",
    "message_id": "bde1b10d-19cf-460f-abcd-26231a82****",
    "recv_time": 1669171015941,
    "status_code": "0",
    "description": "发送成功",
    "msg_count": 1,
    "mccmnc": "46002",
    "iso_code": "CN"
  }
]

Status_code及说明

CodeMessage说明
ZJ10300The Phone number over frequency control.传入电话号码超过频控
ZJ10301The content is illegal. please check the content of the message传入内容有问题,可能是触发关键字等情况
ZJ10302The phone number is on the blacklist.传入电话号码在block名单中,全局黑名单,需要后台解除
ZJ10303Out of Service.企业已停止短信服务/账号欠费等
ZJ10304Non-industry SMS, or high complaint content.非行业短信,或高投诉内容
ZJ10305Sign is on the block list签名黑名单
ZJ10306Unsubscribe words is wrong or none. please check the content of the marketing message.营销短信未带退订方式说明

ZJ10307

repeat sending in a short time in terms of referenceId.Invalid operation to the record, please check the status and the permission

短时间内发送了同样的内容给同样的手机号

ZJ10308Invalid operation to the record, please check the status and the permission短信群发专用错误。取消群发任务时,剩余未发送短信会发送失败
ZJ10309The url in the content is illegal.内容中有高风险 URL
ZJ10311Long url to short url failed长链接转短链接失败
ZJ20000Other其他,与客户支持确认
ZJ20001illegal_number非法手机号
ZJ20002illegal_account_password用户名密码错误
ZJ20003content_length_limit内容超过长度限制
ZJ20004number_not_exist空号
ZJ20005intercept短信拦截,内容,流速,参数等原因
ZJ20006block_list号码在黑名单中
ZJ20007abnormal_state关停欠费携号转网等异常状态
ZJ20008vendor_problem供应商及其下游通道问题
ZJ20009signature_problem签名相关问题

返回值

要求用户侧接收成功后,返回 httpStatus为200,否则火山侧会认为回执失败

常见问题

  1. 回执推送失败后会重试几次?

答:10次,时间间隔:[0,5,10,30,120,300,1200,3600,21600,86400],单位秒。

  1. 返回httpStatus为200的格式是怎样的?

答:http协议里的statuscode返200即可,不是在请求体中返回。