SMS API
createSMSMessage
Anchor link toใช้สำหรับส่งการแจ้งเตือนทาง SMS ไปยังผู้ใช้
POST https://api.pushwoosh.com/json/1.3/createSMSMessage
ส่วนของ Request
Anchor link toชื่อ | จำเป็น | ประเภท | คำอธิบาย |
---|---|---|---|
auth* | ใช่ | string | โทเค็นการเข้าถึง API จาก Pushwoosh Control Panel |
application* | ใช่ | string | รหัสแอปพลิเคชัน Pushwoosh |
notifications* | ใช่ | array | การตั้งค่าเนื้อหา อาร์เรย์ JSON ของพารามิเตอร์ข้อความ ดูรายละเอียดด้านล่าง |
พารามิเตอร์การแจ้งเตือน
ชื่อ | จำเป็น | ประเภท | คำอธิบาย |
---|---|---|---|
send_date* | ใช่ | string | วันที่และเวลาที่ต้องการส่งการแจ้งเตือน ใช้รูปแบบ YYYY-MM-DD HH:mm หรือ now เพื่อส่งทันที |
content* | ใช่ | string | เนื้อหาข้อความของ SMS |
devices* | ใช่ | array | หมายเลขโทรศัพท์ของลูกค้า (ต้องเชื่อมโยงกับ UserId โดยใช้ /registerDevice และระบุในพารามิเตอร์ hwid หรือใช้ use_auto_registration ) สามารถระบุได้เพียงหมายเลขเดียวที่นี่ |
use_auto_registration | ไม่ | boolean | หากตั้งค่าเป็น true หมายเลขโทรศัพท์ที่ระบุในพารามิเตอร์ devices จะถูกลงทะเบียนโดยอัตโนมัติ |
dynamic_content_placeholders | ไม่ | object | ตัวยึดตำแหน่งเนื้อหาแบบไดนามิกเพื่อปรับแต่งเนื้อหาข้อความ ตัวยึดตำแหน่งแต่ละตัวจะถูกแทนที่ด้วยค่าไดนามิกที่สอดคล้องกัน |
preset | ไม่ | string | รหัส SMS Preset จาก Control Panel ของคุณ |
ตัวอย่าง Request
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. }] }}
ตัวอย่าง Response
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)