เทมเพลต SMS
API ต่อไปนี้ช่วยให้คุณสามารถเพิ่ม แก้ไข และลบเทมเพลต SMS รวมถึงการเรียกดูและส่งเทมเพลต SMS และ MMS เพื่อการตรวจสอบ
การเรียกดูเทมเพลตเดี่ยว
ส่งคืนข้อมูลพื้นฐานเกี่ยวกับเทมเพลต SMS
URL
https://sms.api.engagelab.cc/v1/templates/{template_id}
https://sms.api.engagelab.cc/v1/templates/{template_id}
โค้ดนี้โชว์เป็นหน้าต่างลอย
วิธีการร้องขอ HTTP
GET
GET
โค้ดนี้โชว์เป็นหน้าต่างลอย
หัวข้อการร้องขอ
หัวข้อ | ประเภท | จำเป็น | คำอธิบาย |
---|---|---|---|
Authorization | string | true | Basic base64(sms_user:sms_key) |
ตัวอย่างการร้องขอ
curl -X GET "https://sms.api.engagelab.cc/v1/templates/1235"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
curl -X GET "https://sms.api.engagelab.cc/v1/templates/1235"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
โค้ดนี้โชว์เป็นหน้าต่างลอย
คำอธิบายการตอบกลับ
ฟิลด์ | คำอธิบาย |
---|---|
template_id | รหัสเทมเพลต |
template_name | ชื่อเทมเพลต สูงสุด 64 ตัวอักษร |
msg_type | ประเภท SMS, 2 หมายถึง SMS ระหว่างประเทศ |
template_type | ประเภทเนื้อหา SMS, 0 สำหรับรหัสยืนยัน, 1 สำหรับการแจ้งเตือนอุตสาหกรรม, 2 สำหรับการตลาด |
approval_status | สถานะการอนุมัติ, 0 สำหรับรอดำเนินการ, 1 สำหรับอนุมัติ, -1 สำหรับปฏิเสธ, -2 สำหรับยังไม่ได้ส่ง |
approval_message | ข้อความการอนุมัติ, ใช้ได้เฉพาะเมื่อ approval_status เป็น -1 |
template_content | เนื้อหาเทมเพลต สูงสุด 512 ตัวอักษร |
sign_id | รหัสลายเซ็น |
create_time | เวลาสร้าง |
update_time | เวลาอัปเดต |
ตัวอย่างการตอบกลับ
การตอบกลับ-สำเร็จ
สถานะ HTTP: 200
Response-success
HTTP Status: 200
{
"result": {
"template_id": 123,
"template_name": "test",
"msg_type": 2,
"template_type": 1,
"template_content": "Dear %name%,your consumption amount on the platform this month is:***",
"approval_status": 1,
"approval_message": ""
"create_time": "2015-03-23T14:27:48+0800",
"update_time": "2017-03-29T14:27:48+0800"
}
}
{
"result": {
"template_id": 123,
"template_name": "test",
"msg_type": 2,
"template_type": 1,
"template_content": "Dear %name%,your consumption amount on the platform this month is:***",
"approval_status": 1,
"approval_message": ""
"create_time": "2015-03-23T14:27:48+0800",
"update_time": "2017-03-29T14:27:48+0800"
}
}
โค้ดนี้โชว์เป็นหน้าต่างลอย
Response-error
HTTP Status :400
{
"code": 33001,
"message": "The template does not exist"
}
{
"code": 33001,
"message": "The template does not exist"
}
โค้ดนี้โชว์เป็นหน้าต่างลอย
การเรียกดูเทมเพลตหลายรายการ
ส่งคืนข้อมูลพื้นฐานเกี่ยวกับเทมเพลต SMS
URL
https://sms.api.engagelab.cc/v1/templates
https://sms.api.engagelab.cc/v1/templates
โค้ดนี้โชว์เป็นหน้าต่างลอย
วิธีการร้องขอ HTTP
GET
GET
โค้ดนี้โชว์เป็นหน้าต่างลอย
หัวข้อการร้องขอ
หัวข้อ | ประเภท | จำเป็น | คำอธิบาย |
---|---|---|---|
Authorization | String | true | Basic base64(sms_user:sms_key) |
คำอธิบายพารามิเตอร์
พารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
---|---|---|---|
template_ids | string | No | รหัสเทมเพลต แยกด้วยเครื่องหมายอัฒภาค |
approval_status | string | No | สถานะการอนุมัติ, 0 สำหรับรอดำเนินการ, 1 สำหรับอนุมัติ, -1 สำหรับปฏิเสธ, -2 สำหรับยังไม่ได้ส่ง |
template_name | string | No | ชื่อเทมเพลต การจับคู่แบบคลุมเครือ สูงสุด 64 ตัวอักษร |
offset | int | No | ตำแหน่งเริ่มต้นการเรียกดู ช่วง [0-], ค่าเริ่มต้นคือ 0 |
limit | int | No | จำนวนการเรียกดู ช่วง [0-100], ค่าเริ่มต้นคือ 100 |
หมายเหตุ:
- ผู้ใช้สามารถระบุรหัสเทมเพลตสำหรับการเรียกดู; หากไม่ได้ระบุ จะเรียกดูเทมเพลตทั้งหมดโดยค่าเริ่มต้น
ตัวอย่างการร้องขอ
curl -X GET "https://sms.api.engagelab.cc/v1/templates?approval_status=1"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
curl -X GET "https://sms.api.engagelab.cc/v1/templates?approval_status=1"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
โค้ดนี้โชว์เป็นหน้าต่างลอย
คำอธิบายการตอบกลับ
ฟิลด์ | คำอธิบาย |
---|---|
template_id | รหัสเทมเพลต |
template_name | ชื่อเทมเพลต |
msg_type | ประเภทธุรกิจ |
template_type | ประเภทเนื้อหา |
approval_status | สถานะการอนุมัติ |
approval_message | ข้อความการอนุมัติ, ใช้ได้เฉพาะเมื่อ approval_status เป็น -1 |
template_content | เนื้อหาเทมเพลต |
sign_id | รหัสลายเซ็น |
create_time | เวลาสร้าง |
update_time | เวลาอัปเดต |
ตัวอย่างการตอบกลับ
Response-success
HTTP Status: 200
{
"result" : [{
"template_id" : 100,
"template_name" : "tset",
"msg_type" : 2,
"template_type" : 1,
"template_content" : "Dear %name%,your consumption amount on the platform this month is:***",
"approval_status" : 1,
"approval_message": ""
"create_time" : "2016-08-25T14:27:48+0800",
"update_time" : "2016-08-25T14:27:48+0800"
}
],
"count":1,
"total" : 1
}
{
"result" : [{
"template_id" : 100,
"template_name" : "tset",
"msg_type" : 2,
"template_type" : 1,
"template_content" : "Dear %name%,your consumption amount on the platform this month is:***",
"approval_status" : 1,
"approval_message": ""
"create_time" : "2016-08-25T14:27:48+0800",
"update_time" : "2016-08-25T14:27:48+0800"
}
],
"count":1,
"total" : 1
}
โค้ดนี้โชว์เป็นหน้าต่างลอย
Response-error
HTTP Status: 400
{
"code": 30002,
"message": "invalid limit"
}
{
"code": 30002,
"message": "invalid limit"
}
โค้ดนี้โชว์เป็นหน้าต่างลอย
เพิ่มเทมเพลต
ส่งคืนข้อมูลเกี่ยวกับการเพิ่มสำเร็จหรือไม่
URL
https://sms.api.engagelab.cc/v1/templates
https://sms.api.engagelab.cc/v1/templates
โค้ดนี้โชว์เป็นหน้าต่างลอย
วิธีการร้องขอ HTTP
POST
POST
โค้ดนี้โชว์เป็นหน้าต่างลอย
Content-type
application/json
application/json
โค้ดนี้โชว์เป็นหน้าต่างลอย
หัวข้อการร้องขอ
หัวข้อ | ประเภท | จำเป็น | คำอธิบาย |
---|---|---|---|
Authorization | string | true | Basic base64(sms_user:sms_key) |
คำอธิบายพารามิเตอร์
พารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
---|---|---|---|
template_name | string | Yes | ชื่อเทมเพลต ไม่ซ้ำกันในบัญชี สูงสุด 64 ตัวอักษร |
template_content | string | Yes | เนื้อหาเทมเพลต ห้ามมี 【】, [], test หรืออักขระที่คล้ายกัน สูงสุด 512 ตัวอักษร |
template_type | string | Yes | ประเภทเนื้อหา SMS, 0 สำหรับรหัสยืนยัน, 1 สำหรับการแจ้งเตือนอุตสาหกรรม, 2 สำหรับการตลาด |
msg_type | string | No | ประเภทธุรกิจ, 2 หมายถึง SMS ระหว่างประเทศ, ค่าเริ่มต้นคือ 2 |
sign_id | Integer | No | รหัสลายเซ็น SMS |
sign_pos | string | No | ตำแหน่งลายเซ็น, 0 สำหรับคำนำหน้า, 1 สำหรับคำต่อท้าย, ค่าเริ่มต้นคือ 0 |
submit | bool | No | ส่งเพื่อการตรวจสอบโดยตรงหรือไม่, ค่าเริ่มต้นคือ false |
ตัวอย่างการร้องขอ
curl -X POST "https://sms.api.engagelab.cc/v1/templates"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
--header "Content-Type: application/json"
--data '{
"template_name": "test",
"template_content": "Dear %name%,your consumption amount on the platform this month is:***",
"sign_id": 1235,
"template_type": "0"
}'
curl -X POST "https://sms.api.engagelab.cc/v1/templates"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
--header "Content-Type: application/json"
--data '{
"template_name": "test",
"template_content": "Dear %name%,your consumption amount on the platform this month is:***",
"sign_id": 1235,
"template_type": "0"
}'
โค้ดนี้โชว์เป็นหน้าต่างลอย
คำอธิบายการตอบกลับ
ฟิลด์ | คำอธิบาย |
---|---|
template_id | รหัสเทมเพลต |
template_name | ชื่อเทมเพลต |
msg_type | ประเภทธุรกิจ |
template_type | ประเภทเนื้อหา |
approval_status | สถานะการอนุมัติ |
approval_message | ข้อความการอนุมัติ, ใช้ได้เฉพาะเมื่อ approval_status เป็น -1 |
template_content | เนื้อหาเทมเพลต |
sign_id | รหัสลายเซ็น |
create_time | เวลาสร้าง |
update_time | เวลาอัปเดต |
ตัวอย่างการตอบกลับ
Response-success
HTTP Status: 200
{
"result" : {
"template_id" : 200,
"template_name" : "bill",
"msg_type" : 2,
"template_type" : 1,
"template_content" : "Dear %name%,your consumption amount on the platform this month is:***",
"approval_status" : 1,
"approval_message": ""
"create_time" : "2022-08-25T14:35:48+0800",
"update_time" : "2022-08-25T14:35:48+0800"
}
}
{
"result" : {
"template_id" : 200,
"template_name" : "bill",
"msg_type" : 2,
"template_type" : 1,
"template_content" : "Dear %name%,your consumption amount on the platform this month is:***",
"approval_status" : 1,
"approval_message": ""
"create_time" : "2022-08-25T14:35:48+0800",
"update_time" : "2022-08-25T14:35:48+0800"
}
}
โค้ดนี้โชว์เป็นหน้าต่างลอย
Response-error
HTTP Status: 400
{
"code": 33006,
"message": "Template name only supports 64 characters"
}
{
"code": 33006,
"message": "Template name only supports 64 characters"
}
โค้ดนี้โชว์เป็นหน้าต่างลอย
ส่งเพื่อการตรวจสอบ
ส่งคืนข้อมูลพื้นฐานเกี่ยวกับการส่งสำเร็จหรือไม่
URL
https://sms.api.engagelab.cc/v1/templates/{template_id}/submit
https://sms.api.engagelab.cc/v1/templates/{template_id}/submit
โค้ดนี้โชว์เป็นหน้าต่างลอย
วิธีการร้องขอ HTTP
POST
POST
โค้ดนี้โชว์เป็นหน้าต่างลอย
Content-type
application/json
application/json
โค้ดนี้โชว์เป็นหน้าต่างลอย
หัวข้อการร้องขอ
หัวข้อ | ประเภท | จำเป็น | คำอธิบาย |
---|---|---|---|
Authorization | String | true | Basic base64(sms_user:sms_key) |
ตัวอย่างการร้องขอ
curl -X POST "https://sms.api.engagelab.cc/v1/templates/3381/submit"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
--header "Content-Type: application/x-www-form-urlencoded"
curl -X POST "https://sms.api.engagelab.cc/v1/templates/3381/submit"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
--header "Content-Type: application/x-www-form-urlencoded"
โค้ดนี้โชว์เป็นหน้าต่างลอย
ตัวอย่างการตอบกลับ
Response-success
HTTP Status: 200
{
}
{
}
โค้ดนี้โชว์เป็นหน้าต่างลอย
อัปเดตเทมเพลต
ส่งคืนข้อมูลพื้นฐานเกี่ยวกับการอัปเดตสำเร็จหรือไม่
URL
https://sms.api.engagelab.cc/v1/templates/{template_id}
https://sms.api.engagelab.cc/v1/templates/{template_id}
โค้ดนี้โชว์เป็นหน้าต่างลอย
วิธีการร้องขอ HTTP
PUT
PUT
โค้ดนี้โชว์เป็นหน้าต่างลอย
Content-type
application/json
application/json
โค้ดนี้โชว์เป็นหน้าต่างลอย
หัวข้อการร้องขอ
หัวข้อ | ประเภท | จำเป็น | คำอธิบาย |
---|---|---|---|
Authorization | String | true | Basic base64(sms_user:sms_key) |
คำอธิบายพารามิเตอร์
พารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
---|---|---|---|
template_name | string | No | ชื่อเทมเพลต สูงสุด 64 ตัวอักษร |
template_content | string | No | เนื้อหาเทมเพลต ห้ามมี 【】, [], test หรืออักขระที่คล้ายกัน สูงสุด 512 ตัวอักษร |
sign_id | Integer | No | รหัสลายเซ็น SMS |
sign_pos | string | No | ตำแหน่งลายเซ็น: 0 สำหรับคำนำหน้า, 1 สำหรับคำต่อท้าย, ค่าเริ่มต้นคือ 0 |
template_type | string | No | ประเภทเนื้อหา SMS, 0 สำหรับรหัสยืนยัน, 1 สำหรับการแจ้งเตือนอุตสาหกรรม, 2 สำหรับการตลาด |
submit | bool | No | ส่งเพื่อการตรวจสอบโดยตรงหรือไม่, ค่าเริ่มต้นคือ false |
หมายเหตุ:
- หลังจากเรียกใช้ API นี้ การอัปเดต template_name จะไม่เปลี่ยนสถานะการอนุมัติของเทมเพลต แต่การอัปเดตพารามิเตอร์อื่นๆ จะเปลี่ยน
ตัวอย่างการร้องขอ
curl -X PUT "https://sms.api.engagelab.cc/v1/templates/3381"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
--header "Content-Type: application/json"
--data '{
"template_name": "test",
"template_content": "Dear %name%,your consumption amount on the platform this month is:***",
"sign_id": 132,
"template_type": 0
}'
curl -X PUT "https://sms.api.engagelab.cc/v1/templates/3381"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
--header "Content-Type: application/json"
--data '{
"template_name": "test",
"template_content": "Dear %name%,your consumption amount on the platform this month is:***",
"sign_id": 132,
"template_type": 0
}'
โค้ดนี้โชว์เป็นหน้าต่างลอย
ตัวอย่างการตอบกลับ
Response-success
HTTP Status: 200
{
"count": 1
}
{
"count": 1
}
โค้ดนี้โชว์เป็นหน้าต่างลอย
Response-error
HTTP Status: 401
{
"code": 30000,
"message": "Authentication failed"
}
{
"code": 30000,
"message": "Authentication failed"
}
โค้ดนี้โชว์เป็นหน้าต่างลอย
ลบเทมเพลต
ส่งคืนข้อมูลพื้นฐานเกี่ยวกับการลบสำเร็จหรือไม่
URL
https://sms.api.engagelab.cc/v1/templates/{template_id}
https://sms.api.engagelab.cc/v1/templates/{template_id}
โค้ดนี้โชว์เป็นหน้าต่างลอย
วิธีการร้องขอ HTTP
DELETE
DELETE
โค้ดนี้โชว์เป็นหน้าต่างลอย
หัวข้อการร้องขอ
หัวข้อ | ประเภท | จำเป็น | คำอธิบาย |
---|---|---|---|
Authorization | String | true | Basic base64(sms_user:sms_key) |
ตัวอย่างการร้องขอ
curl -X DELETE "https://sms.api.engagelab.cc/v1/templates/3381"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
curl -X DELETE "https://sms.api.engagelab.cc/v1/templates/3381"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
โค้ดนี้โชว์เป็นหน้าต่างลอย
ตัวอย่างการตอบกลับ
Response-success
HTTP Status: 200
{
"count": 1
}
{
"count": 1
}
โค้ดนี้โชว์เป็นหน้าต่างลอย