SMS Template

อัพเดทล่าสุด :2023-04-10

The following interface allows for adding, modifying, and deleting SMS templates, as well as querying, submitting, and approving SMS and SMS templates.

Query

Detailed information of returned SMS template

URL

https://sms.api.engagelab.cc/v1/templates/{template_id}
          https://sms.api.engagelab.cc/v1/templates/{template_id}

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

HTTP Request Method

GET
          GET

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Request-Headers

Header Type Required Description
Authorization string true Basic base64(sms_user:sms_key)

Request Example

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>>"

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Return Value Description

Parameter Description
template_id template ID
template_name template name
msg_type SMS type,2 represents international SMS
template_type SMS content type, 0 represents verification code, 1 represents industry notification, and 2 represents marketing.
approval_status review status, 0 indicates pending review, 1 indicates approved review, -1 indicates failed review, -2 has not been submitted for review.
approval_message review information, only approval_Status -1 has value.
template_content template content, up to 512 characters long
create_time time of template creation
update_time time of template modification

Returned Value Example

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"
}

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Query (Batch)

Basic information of returned SMS template ​

URL

https://sms.api.engagelab.cc/v1/templates
          https://sms.api.engagelab.cc/v1/templates

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

HTTP Request Method

GET
          GET

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Request-Headers

Header Type Required Description
Authorization String true Basic base64(sms_user:sms_key)

Query Parameter Description

Parameter Type Required Description
template_ids string no template ID, used for multiple purposes; separate
approval_status string no review status, 0 indicates pending review, 1 indicates approved review, -1 indicates failed review, -2 has not been submitted for review.
template_name string no template name, fuzzy matching
offset int no offset position, [0-], defaults to 0
limit int no amount, [0-100],defaults to 100

Tips:

  1. Users can specify a template ID for querying. If not specified, all templates will be queried by default.

Request Example

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>>"

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Return Value Description

Parameter Description
template_id ID of template
template_name name of template
msg_type SMS type
template_type SMS content type
approval_status review status
approval_message review information, only approval_Status -1 has value
template_content template content
sign_id ID of sign
create_time time of template creation
update_time time of template modification

Returned Value Example

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"
}

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Add

Return information on whether the addition was successful

URL

https://sms.api.engagelab.cc/v1/templates
          https://sms.api.engagelab.cc/v1/templates

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

HTTP Request Method

POST
          POST

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Content-type

application/json
          application/json

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Request-Headers

Header Type Required Description
Authorization string true Basic base64(sms_user:sms_key)

Parameter Description

Parameter Type Required Description
template_name string yes template name, unique within the account, with a maximum length of 64 characters.
template_content string yes template content cannot contain characters such as [],【】, test, 测试, with a maximum length of 512 characters
template_type string yes SMS content type, 0 represents verification code, 1 represents industry notification, and 2 represents marketing.
msg_type string no SMS type, 2 represents international SMS, defaults to 2
sign_id Integer yes ID of sign
sign_pos string no sign position, 0 represents front, 1 represents back, defaults to 0
submit bool no whether to directly submit for review, default to false

Request Example

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"
}'  

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Return Value Description

Parameter Description
template_id template ID
template_name template name
msg_type SMS type
template_type SMS content type
approval_status review status
approval_message review information, only approval_Status -1 has value
template_content template content
sign_id ID of sign
create_time time of template creation
update_time time of template modification

Returned Value Example

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"
}

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Submit

Return basic information on whether the submission was successful

URL

https://sms.api.engagelab.cc/v1/templates/{template_id}/submit
          https://sms.api.engagelab.cc/v1/templates/{template_id}/submit

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

HTTP Request Method

POST
          POST

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Content-type

application/json
          application/json

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Request-Headers

Header Type Required Description
Authorization String true Basic base64(sms_user:sms_key)

Request Example

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"

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Returned Value Example

Response-success

HTTP Status: 200

{ }
          { 
  
}

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Modify

Return basic information on whether the submission was successful

URL

https://sms.api.engagelab.cc/v1/templates/{template_id}
          https://sms.api.engagelab.cc/v1/templates/{template_id}

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

HTTP Request Method

PUT
          PUT

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Content-type

application/json
          application/json

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Request-Headers

Header Type Required Description
Authorization String true Basic base64(sms_user:sms_key)

Parameter Description

Parameter Type Required Description
template_name string no template name, unique within the account, with a maximum length of 64 characters.
template_content string no template content cannot contain characters such as [],【】, test, 测试, with a maximum length of 512 characters
sign_id Integer no ID of sign
sign_pos string no sign position, 0 represents front, 1 represents back, defaults to 0
template_type string no SMS content type, 0 represents verification code, 1 represents industry notification, and 2 represents marketing
submit bool no whether to directly submit for review, default to false

Tips:
1.After calling this interface, update the template_ name will not cause a change in the template approval status, while updating other parameters will cause a change in the template approval status.

Request Example

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
    }'  

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Returned Value Example

Response-success

HTTP Status: 200

{ "count": 1 }
           { 
 "count": 1 
 }

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Response-error

HTTP Status: 401

{ "code": 30000, "message": "Authentication failed" }
          {
  "code": 30000,
  "message": "Authentication failed"
}

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Delete

URL

https://sms.api.engagelab.cc/v1/templates/{template_id}
          https://sms.api.engagelab.cc/v1/templates/{template_id}

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

HTTP Request Method

DELETE
          DELETE

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Request-Headers

Header Type Required Description
Authorization String true Basic base64(sms_user:sms_key)

Request Example

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>>"

        
โค้ดนี้โชว์เป็นหน้าต่างลอย

Returned Value Example

Response-success

HTTP Status: 200

{ "count": 1 }
           { 
 "count": 1 
 }

        
โค้ดนี้โชว์เป็นหน้าต่างลอย
在文档中心打开
icon
Contact Sales