短信回执回调 - nxtele/http-api-document GitHub Wiki
简要描述:
- 短信回执(DR)推送
请求URL:
- DR推送的Http接口地址(由用户提供)
例如: http://106.15.34.94:8989/sms/testDr
请求方式:
- POST x-www-form-urlencoded
- 2023/5/4之前注册的客户,参数在url;之后的客户,参数在 post body 。
参数:
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
phone | 是 | string | 手机号 |
status | 是 | string | 状态代码:2:成功下发,其他数字都未下发成功 |
result | 是 | string | 回执内容: DELIVRD\ UNDELIV |
drtime | 是 | string | 回执报告时间,格式为:yyyy-MM-dd HH:mm:ss |
messageid | 是 | string | 短信id,对应的短信提交成功得到的id |
currency | 是 | string | price的币种 如:CNY\ USD |
price | 是 | string | 对应币种的短信单价 |
rate | 是 | string | 美元对人民币汇率 如:7.05 |
sendtime | 是 | string | 发送时间,格式为:yyyy-MM-dd HH:mm:ss |
size | 是 | string | 计费条数 |
ext | 否 | string | 透传字段,该字段为短信下行发送接口中的非必填字段,填写后在回执中会原样返回,仅支持http |
推送示例
2023/5/24 之前注册的客户,url 传递参数
POST http://106.15.34.94:8080/sms/testDr?result=DELIVRD&size=1&phone=6282167624806&rate=6.4845&price=0.045&messageid=b308d94a73f94e6d84ae975c41f4b2a6&drtime=2021-02-26 10:01:15¤cy=USD&sendtime=2021-02-26 10:01:15&status=2
2023/5/24 之后注册的客户,post body
POST http://106.15.34.94:8080/sms/testDr
Content-Type: x-www-form-urlencoded
result=DELIVRD&size=1&phone=6282167624806&rate=6.4845&price=0.045&messageid=b308d94a73f94e6d84ae975c41f4b2a6&drtime=2021-02-26 10:01:15¤cy=USD&sendtime=2021-02-26 10:01:15&status=2
回执状态对应码
public static final int DELIVRD = 2; // 成功
public static final int UNDELIV = 5; // 失败
public static final int REJECTD = 6; // 拒绝
public static final int EXPIRED = 7; // 过期
public static final int DELETED = 8; // 删除
public static final int DND = 9; // 免打扰
public static final int ESME_RINVSRCADR = 11; // 错误发件人
public static final int UNKNOWN = 12; // 未知
用户返回值
成功返回字符串:success
失败返回字符串:error
备注
说明:DR只推送一次,如果需要重新获取可以手动拉取DR处理