ข้ามไปยังเนื้อหา

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)