SMS API
createSMSMessage 已弃用
Anchor link to用于向用户发送 SMS 通知。
POST https://api.pushwoosh.com/json/1.3/createSMSMessage
请求正文
Anchor link to| 名称 | 必需 | 类型 | 描述 |
|---|---|---|---|
| auth* | 是 | 字符串 | 来自 Pushwoosh Control Panel 的 API access token。 |
| application* | 是 | 字符串 | Pushwoosh application code |
| notifications* | 是 | 数组 | 内容设置。消息参数的 JSON 数组。详见下文。 |
通知参数
| 名称 | 必需 | 类型 | 描述 |
|---|---|---|---|
| send_date* | 是 | 字符串 | 发送通知的日期和时间。使用格式 YYYY-MM-DD HH:mm 或 now 立即发送。 |
| content* | 是 | 字符串 | SMS 消息的文本内容。 |
| devices* | 是 | 数组 | 客户电话号码(必须使用 /registerDevice 与 UserId 关联,并在 hwid 参数中指定,或使用 use_auto_registration)。此处只能指定一个号码。 |
| use_auto_registration | 否 | 布尔值 | 如果设置为 true,在 devices 参数中指定的电话号码将被自动注册。 |
| dynamic_content_placeholders | 否 | 对象 | 动态内容占位符,用于自定义消息内容。每个占位符都将被替换为相应的动态值。 |
| preset | 否 | 字符串 | 来自您 Control Panel 的 SMS Preset Code。 |
请求示例
Anchor link to{ "request": { "application": "12345-67891", // 必需。Pushwoosh application code。 "auth": "yxoPUlwqm…………pIyEX4H", // 必需。来自 Pushwoosh Control Panel 的 API access token。 "notifications": [{ "send_date": "now", // 必需。YYYY-MM-DD HH:mm 或 "now"。 "content": "Hello!", // 必需。SMS 文本 (字符串)。 "devices": ["+1234567890"], // 必需。客户电话号码 (必须与 // UserId 关联,使用 /registerDevice 并在 // "hwid" 参数中指定,或使用 "use_auto_registration")。 // 此处只能指定一个号码。 "preset": "XXXXX-XXXXX", // 可选。来自您 Control Panel 的 SMS Preset Code。 "use_auto_registration": true // 可选。自动注册在 "devices" 参数中指定的 // 电话号码。 }] }}响应示例
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 方法。
您还可以在消息历史部分查看每条消息的统计数据。