API: Message/send

The original link

An overview of


Message/Send is SUBMAIL’s SMS API. The Message/Send API provides powerful SMS sending functions and allows users to customize the SMS signature and body. There is no need to create templates in advance. SUBMAIL automatically creates templates and sends them according to the SMS signature and content you submit.



** URL**


< the > https://api.mysubmail.com/message/send
< for > https://api.submail.cn/message/send


Supported formats


format URL
json https://api.mysubmail.com/message/send.json (the default)
xml https://api.mysubmail.com/message/send.xml


HTTP Request Mode


Request way Set the content-type
http post Multipart /form-data, X-www-form-urlencoded, Application /json


Whether authorization is required


is
Refer to theAPI authorization and authentication mechanisms


Request parameters


parameter type Required/optional The default describe
appid string necessary There is no ID of the SMS application created in the SUBMAIL application integration
to string necessary There is no Recipient’s mobile phone number. This API only supports one-to-one mode (that is, only one contact can be sent in a single API request). This parameter can now only submit one bit contact.
content string necessary There is no SMS text

[SUBMAIL] Your SMS verification code: 4438, please enter it within 10 minutes.

content Parameters will be matched with the SMS template in your account. If there is no matching API, a SMS template will be created and submitted to manual review. After passing the review, the next similar SMS submitted (content reaches a certain degree of match) will not trigger manual review and be directly delivered. The template TEMPLate_REJECT event in SUBHOOK is triggered when the audit fails

Keep the SMS body within 1000 characters.)
tag string optional There is no Custom tags that can be used for SUBHOOK tracing

API requests with tag parameters up to 32 characters will carry this parameter in all SUBHOOK events. Tag parameter does not participate in encryption calculation.
timestamp A UNIX timestamp optional There is no Refer to theAPI authorization and authentication mechanism > TimestampA UNIX timestamp
sign_type string optional normal API Authorization Mode (md5 or sha1 or normal

Refer to theAPI authorization and authentication mechanism> Authorization and authentication modes
sign_version string optional There is no Signature Encryption computing mode

(When sign_version is passed 2, the content parameter does not participate in the encryption calculation)
signature string necessary There is no Apply a key or digital signature

Refer to theAPI authorization and authentication mechanism> Authorization and authentication modes. When sign_type is normal, signature should pass the value of appKey.


Code sample


Send a test message


POST URL
https://api.mysubmail.com/message/send.json
Copy the code


POST DATA
appid=your_app_id &amp; to=138xxxxxxxx &amp; Content = [SUBMAIL] Your SMS verification code: 4438, please enter it within 10 minutes. &amp; signature=your_app_keyCopy the code


return
{
    "status": "success",
    "send_id": "c2f0e679ad8dxxxxxf6cb71bf2925665e0",
    "fee": 1,
    "sms_credits": "21129",
    "transactional_sms_credits": "0"
}
Copy the code


Use CURL to send a test text


Send the CURL
curl -d 'appid=your_app_id&amp; to=138xxxxxxxx&amp; Content = [SUBMAIL] Your SMS verification code: 4438, please enter it within 10 minutes. &amp; signature=your_app_key' https://api.mysubmail.com/message/send.jsonCopy the code


return
{
    "status": "success",
    "send_id": "c2f0e679ad8dxxxxxf6cb71bf2925665e0",
    "fee": 1,
    "sms_credits": "21129",
    "transactional_sms_credits": "0"
}
Copy the code


The return value


The request is successful
{
    "status": "success",
    "send_id": "c2f0e679ad8dxxxxxf6cb71bf2925665e0",
    "fee": 1,
    "sms_credits": "21129",
    "transactional_sms_credits": "0"
}
Copy the code


The request failed
{
      "status":"error",
      "code":"1xx",
      "msg":"error message"
}
Copy the code


The error code


Refer to theAPI error code