Send

最新の更新:2023-04-10

Send

Send a SMS template to one or more users

URL

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

        
このコードブロックは、フローティングウィンドウに表示されます

HTTP Request Method

POST
          POST    

        
このコードブロックは、フローティングウィンドウに表示されます

Content-Type

Content-Type: application/json;charset=utf-8
          Content-Type: application/json;charset=utf-8

        
このコードブロックは、フローティングウィンドウに表示されます

Request-Headers

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

Body Parameter Description

Parameter Type Required Description
from string no the sender name can support up to 3-11 characters and can only be in English and numbers, with a default of blank,display based on actual effect.
to array yes list of mobile phone numbers, with a maximum of 1000 in the list.
body object yes SMS content settings
template_id int yes ID of template
msg_type int no SMS type, 2 represents international SMS, defaults to 2.
label_id int no SMS label
vars object no variable. Up to 1MB
custom_args object no optional fields customized by the customer. The maximum size is 1KB.
request_id string no ID of this sending request; 128 characters maximum.

Tips:

  1. Vars is used for variable replacement of mail content. The format is json object, and the format is' {"varname": ["value1," value2 "]} ', where varname is the mail content variable.
  2. The message content is: Welcome to the %sp% SMS service. Corresponding vars value: {"sp": "engagelab"} SMS content replacement: Welcome to use EngageLab SMS service.
  3. Each value in vars cannot exceed 16 characters in length by default, formatted as a string, and variables cannot contain HTTP links (please contact customer service for special requirements).
  4. The system will replace the variables in the SMS template with the parameters in vars, and all phone numbers will receive the same replaced content.
  5. As customer_args defined by yourself, will be embedded in the header; The subsequent SMSHook data will be returned to you.
  6. The request_id is to prevent repeated submission, and the validity period is 1 hour. If it is submitted repeatedly within 1 hour, the last request result will be returned.

Request Example

curl -X POST "https://sms.api.engagelab.cc/v1/send" --header "Authorization: Basic <<YOUR_SMS_KEY_HERE>>" --header "Content-Type: application/json" --data '{ "from": "xxxx", "to": ["+12673800456", "+12673800455"], "request_id":"123" , "body":{ "template_id": 2336, "label_id": 231, "vars": { 'week':"Tuesday" } } }'
          curl -X POST "https://sms.api.engagelab.cc/v1/send" 
--header "Authorization: Basic <<YOUR_SMS_KEY_HERE>>" 
--header "Content-Type: application/json" 
--data '{
    "from": "xxxx",
    "to": ["+12673800456", "+12673800455"],  
     "request_id":"123" ,
    "body":{
        "template_id": 2336,
        "label_id": 231,
        "vars": {
        'week':"Tuesday"
        }
    }
}'  

        
このコードブロックは、フローティングウィンドウに表示されます

Returned Value Description

Parameter Description
success_count number of successful transmissions
sms_ids list of successfully sent SMS IDs
failed_count number of failed sending
failed_items send a list of failed phones and the reasons for the failure
phone phone
message reason for failure
request_id ID of this sending request
custom_args optional fields customized by the customer

Returned Value Example

Response-success

HTTP Status: 200

//example of successful return results { "sms_ids": ["1458113381893_15_3_11_1ainnq$+12673800456", "1458113381893_15_3_11_1ainnq$+12673800456"] "request_id":"123" } // example of partially successful return results { "code": 41031, "message": "partial success", "success_count": 1, "sms_ids": ["1458113381893_15_3_11_1ainnq$+12673800456"], "request_id":"123" , "failed_count": 1, "failed_items": [ { "phone":"1233", "message":"Invalid phone number format" } ] }
          //example of successful return results
{ 
  "sms_ids": ["1458113381893_15_3_11_1ainnq$+12673800456", "1458113381893_15_3_11_1ainnq$+12673800456"]   
  "request_id":"123" 
}

// example of partially successful return results
{
    "code": 41031,
    "message": "partial success""success_count": 1,
      "sms_ids": ["1458113381893_15_3_11_1ainnq$+12673800456"],
        "request_id":"123" ,
      "failed_count": 1,
      "failed_items": [
          {
          "phone":"1233",
          "message":"Invalid phone number format"
          }
        ]    
}

        
このコードブロックは、フローティングウィンドウに表示されます

Response-error

HTTP Status :401

{ "code": 30000, "message": "Unauthorized." }
          {
    
    "code": 30000,
    "message": "Unauthorized."
}

        
このコードブロックは、フローティングウィンドウに表示されます

Response-error

HTTP Status :400

// example of failed return results { "code": 32002, "message": "Invalid phone number format" }
          // example of failed return results
{
    "code": 32002,
        "message": "Invalid phone number format"
}

        
このコードブロックは、フローティングウィンドウに表示されます
在文档中心打开
icon
営業に連絡する