SMS API
createSMSMessage
Anchor link to用于向用户发送 SMS 通知
POST https://api.pushwoosh.com/json/1.3/createSMSMessage
| 名称 | 是否必须 | 类型 | 描述 |
|---|---|---|---|
| auth* | 是 | string | 来自 Pushwoosh 控制面板的 API Access Token。 |
| application* | 是 | string | Pushwoosh Application Code |
| notifications* | 是 | array | 内容设置。消息参数的 JSON 数组。详见下文。 |
通知参数
| 名称 | 是否必须 | 类型 | 描述 |
|---|---|---|---|
| send_date* | 是 | string | 发送通知的日期和时间。使用格式 YYYY-MM-DD HH:mm 或 now 立即发送。 |
| content* | 是 | string | SMS 消息的文本内容。 |
| devices* | 是 | array | 客户电话号码(必须使用 /registerDevice 与 UserId 关联并在 hwid 参数中指定,或使用 use_auto_registration)。此处只能指定一个号码。 |
| use_auto_registration | 否 | boolean | 如果设置为 true,devices 参数中指定的电话号码将被自动注册。 |
| dynamic_content_placeholders | 否 | object | 用于自定义消息内容的动态内容占位符。每个占位符将被相应的动态值替换。 |
| preset | 否 | string | 来自控制面板的 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 部分查看每条消息的统计信息。