Note |
---|
The MailUp transactional API for SMS does not use OAuth 2.0. Please refer to the "Getting started" section below for details. |
Overview
The MailUp transactional API for text messages (SMS) is the best choice when you have to send single sending individual text messages, regardless of the number of messages you need to send.
The main features of this API are the following:
- sending is immediate
- authentication is very simple
- it works on http with HTTP post, then which means that you can use the "send" command as a callback function into a in any system that supports webhooks
Getting started
...
Using the ListSecret parameter
In order to send an SMS you need to know the "ListSecret" value of the MailUp list you are using. "ListSecret" is an additional field , which is that has been added to introduce a level of security to these API methods, it is list specific and it can be enabled/disabled using APIs.
- You can
...
- use the GET method to check if a ListSecret already exists.
- If it does not, you can use the POST method to create it.
- As soon as you get the value of ListSecret you can start sending text messages (refer to next paragraph) with no restrictions.
If you want to disable the ability to send transactional SMS on that list, you can use DELETE method. This method can also be used - followed by a POST method - to change an existing ListSecret value.
All these methods require Basic Authentication, hence an encoded value must be specified as header
Code Block |
---|
Format: "Authorization: Basic " + Base64(username:password)
Example: username=m1234, password=hello123, Base64(m1234:hello123)=bTEyMzQ6aGVsbG8xMjM= => Authorization: Basic bTEyMzQ6aGVsbG8xMjM= |
Once you have obtained the value of the ListSecret parameter:
- you can start sending transactional text messages (see example below)
- basic authentication is no longer required in those API calls
Retrieving, creating, and deleting the ListSecret parameter
Expand | |||||||
---|---|---|---|---|---|---|---|
| |||||||
|
...
Expand | |||||
---|---|---|---|---|---|
| |||||
|
You can use GET method to check if a ListSecret is already configured (if not, you should use POST method). As soon as you get the value of ListSecret you can start sending text messages (refer to next paragraph) with no restrictions. If you want to disable transactional APIs, you can use DELETE method, which can also be used, when followed by a POST method, to change the ListSecret value
How to send an SMS
...
Sending a transactional SMS
The example below sends an SMS to the number +393350000001
Code Block | ||||
---|---|---|---|---|
| ||||
POST https://sendsms.mailup.com/api/v2.0/sms/{account_ID}/{List_ID} HTTP/1.1 User-Agent: Fiddler Host: sendsms.mailup.com Content-Type: application/json;odata=verbose;charset=utf-8 Content-Length: 428 { "Content":"Hi [Name], welcome to [City]", "ListGuid":"xxxxxxxx-aaa-bbbb-cccc-e3a98b626156", "ListSecret":"yyyyyyyy-ddd-eeee-ffff-3e1cb0e6e64c", "Recipient":"+393350000001", "CampaignCode":"Welcome messages", "DynamicFields":[{"N":"Name","V":"John"},{"N":"City","V":"Cremona"}], "isUnicode":0 } |
Anchor Transactional_SMS_parameters Transactional_SMS_parameters
Request
Transactional_SMS_parameters | |
Transactional_SMS_parameters |
Expand | |||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||||||||||||||||||
| List Secret | Key that must be specified on MailUp console in order to enable this API (it’s an auto-generated GUID)
ListSecret | Auto-generated GUID that can be used to enable or disable the use of this API. Together with the "List GUID" value, it is used to provide a security enforcement. See the sections above to learn how to get it. | String |
CampaignCode | Used to aggregate statistics on MailUp under a container text message whose name correspond to the specified text string. If |
the specified value does not |
exist, |
a new |
item is created |
. Otherwise the existing one is reused. | String |
Content |
The text of the message to be sent. No parsing nor length check is required. |
SIZE LIMIT: messages longer than |
670 characters are truncated by the sending engine |
. | String |
Recipient | The recipient’s number. |
Include the international prefix (either with 00 or +), |
or the default list prefix will be applied. (Ask for MailUp standard regex for phone numbers). Only a single phone number is allowed |
Always check subscription status on specified list (SMS_Optin table)
New = subscribe and send
Subscribed = send
Pending or Unsubscribed =do not send
String | ||
DynamicFields | An array of value pairs that allows you to use merge tags in your transactional text messages. | String |
IsUnicode | (optional) Boolean value indicating whether to use Western alphabets only (0 means "false"), or Eastern alphabets as well, such as Arabic, Russian, Chinese, and so on (1 means "true"). The |
caller is responsible for specifying if the message contains Unicode characters. | Boolean | |
Sender | (optional) Message sender. It can be numeric or alphanumeric but some restrictions may apply. As a consequence, when the sender value is not allowed, the message may be blocked or the sender may be replaced. We recommend you to specify this value only when you are confident about the delivery result (e.g. you've already tested it using the MailUp web platform), otherwise it is better to not specify this parameter in the request. In addition, in some countries the sender may be subject to local restrictions and it may be overwritten by the carriers before being delivered. You can contact us if you need support for some specific nations. | String* |
TemplateId | (optional) reference to a MailUp message ID that has already been defined on MailUp. Do not add the "Content" parameter if you want to use TemplateId | Integer |
* max 11 chars, only letters and numbers (a-zA-Z0-9)
Response
...
Expand | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This table shows possible HTTP response statuses that can be returned by the this API methods , and the corresponding error code provided by the application (inside the response).
500 The message was sent but the statistics are incorrect due to an error
|
In addition to HTTP and Application codes, a successful response has the following format:
where DeliveryId is a unique identifier that can be used to retrieve the result of a specific sending (link), while Cost is the cost in credits of the sending operation. Note: in case of a response with HTTP code = 200 and Application code = 301, the message is properly sent and a cost is charged, but the returned value of DeliveryId is 0 (zero) and it not possible to retieve the result |