SMS Receipt API
Overview
The SMS Receipt API provides interfaces for obtaining SMS sending status and uplink SMS messages.
Note: SMS sending status and uplink SMS messages can also be obtained through callbacks. If developers have already used the callback method, the SMS Receipt API cannot be used to obtain them.
HTTP Authentication
Access authorization uses HTTP Basic Authentication. This allows the entire API request to be completed with common HTTP tools such as curl and browser plugins.
Add a field (Key/Value pair) to the HTTP Header:
Authorization: Basic base64_auth_string
The generation algorithm for base64_auth_string is base64(appKey:masterSecret): concatenate the appKey, a colon, and the masterSecret, then Base64-encode the resulting string. The appKey and masterSecret can be viewed in the application settings in the console.
Obtain SMS Sending Status
Function Description
- Obtain SMS sending status reports under an appKey.
- The API call frequency is once every 5 seconds. Each call can obtain up to 500 records. The records can be viewed only once and cannot be obtained again.
- Each SMS sending status report is retained for up to three days, starting from the time Jiguang receives the status report returned by the carrier.
Request URL
Request Example
curl --insecure -X GET -v https://api.sms.jpush.cn/v1/report -H "Content-Type: application/json" -u "7d431e42dfa6a6d693ac2d04:5e987ac6d2e04d95a9d8f0d2"
Parameters
- None
Response Example
Successful Request
[{"msgId":"88235123435","phone":"18612345577","receiveTime":1575015093000,"status":4001},{"msgId":"88235123436","phone":"18612345578","receiveTime":1575015093000,"status":4001}]
Sending Status Description
| CODE | DESCRIPTION |
|---|---|
| 4001 | Sent successfully |
| 4002 | The called phone number is on the carrier blacklist. Contact the carrier for handling. |
| 4003 | Mobile terminal issue, such as powered off or suspended service. Confirm whether the phone status is normal. |
| 4004 | The called phone number is an invalid number. Verify whether the phone number is compliant. |
| 4005 | Insufficient remaining SMS quota |
| 4006 | Sending too frequently; the sending frequency exceeds carrier limits |
| 4007 | No answer. Voice SMS status: the voice SMS call was successful, but the user did not answer or rejected the call. |
| 4008 | User busy. Voice SMS status: the called user is busy. |
| 4009 | Cannot connect. Voice SMS status: out of service area, no phone signal, or call forwarded to missed call reminder, etc. |
| 4010 | Sensitive word interception. The carrier intercepted the SMS because the content contains sensitive words. |
| 4100 | Other error |
Failed Request
{
"error": {
"code": \*\*\*\*\*,
"message": "\*\*\*\*\*"
}
}
Obtain Uplink SMS Messages
Function Description
- Obtain uplink SMS messages under an appKey.
- The API call frequency is once every 5 seconds. Each call can obtain up to 500 records.
- Each uplink SMS message is retained for up to seven days, starting from the time Jiguang receives the uplink message returned by the carrier.
Request URL
Request Example
curl --insecure -X GET -v https://api.sms.jpush.cn/v1/reply -H "Content-Type: application/json" -u "7d431e42dfa6a6d693ac2d04:5e987ac6d2e04d95a9d8f0d2"
Parameters
- None
Response Example
Successful Request
[{"content":"Thanks!","phone":"18612345577","replyTime":1575200268000},{"content":"Thanks!","phone":"18612345578","replyTime":1572581532000}]
Failed Request
{
"error": {
"code": \*\*\*\*\*,
"message": "\*\*\*\*\*"
}
}