跳到内容

SMS API

createSMSMessage

Anchor link to

用于向用户发送 SMS 通知

POST https://api.pushwoosh.com/json/1.3/createSMSMessage

名称是否必须类型描述
auth*string来自 Pushwoosh 控制面板的 API Access Token
application*stringPushwoosh Application Code
notifications*array内容设置。消息参数的 JSON 数组。详见下文。

通知参数

名称是否必须类型描述
send_date*string发送通知的日期和时间。使用格式 YYYY-MM-DD HH:mmnow 立即发送。
content*stringSMS 消息的文本内容。
devices*array客户电话号码(必须使用 /registerDevice 与 UserId 关联并在 hwid 参数中指定,或使用 use_auto_registration)。此处只能指定一个号码。
use_auto_registrationboolean如果设置为 truedevices 参数中指定的电话号码将被自动注册。
dynamic_content_placeholdersobject用于自定义消息内容的动态内容占位符。每个占位符将被相应的动态值替换。
presetstring来自控制面板的 SMS Preset Code

请求示例

Anchor link to
{
"request": {
"application": "12345-67891", // required. Pushwoosh application code.
"auth": "yxoPUlwqm…………pIyEX4H", // required. API access token from Pushwoosh Control Panel.
"notifications": [{
"send_date": "now", // required. YYYY-MM-DD HH:mm OR "now".
"content": "Hello!", // required. SMS text (string).
"devices": ["+1234567890"], // required. Customer phone number (must be associated with
// a UserId using. /registerDevice and specified in
// the "hwid" parameter or use "use_auto_registration").
// Only one number can be specified here.
"preset": "XXXXX-XXXXX", // optional. SMS Preset Code from your Control Panel.
"use_auto_registration": true // optional. Automatically register phone number specified
// in "devices" parameter.
}]
}
}

响应示例

Anchor link to
{
"status_code": 200,
"status_message": "OK",
"response": {
"Messages": [
"9648-0B10ECB6-0D9F214D"
]
}
}

错误响应

Anchor link to
{
"status_code": 210,
"status_message": "Invalid devices list. \"devices\" must be an array.",
"response": {
"Messages": []
}
}

要获取 SMS 统计信息,请使用 totalsByIntervals 方法。

您也可以在 Message History 部分查看每条消息的统计信息。