Send SMS & MMS Messages
The primary reason for using the Wire2Air API is to send SMS text messages. This page describes the following details about sending messages:
- Endpoint
- Parameters
- Response
Endpoint
To send messages using Wire2Air Rest API, send a POST request to the messages URL:
POST https://msgapi.wire2air.com/rest/v1/message
Parameters
Name | Required? | Examples | Description |
---|---|---|---|
To | Yes | e.g 12121234567 (for US), 447700900012 (for UK) | DESTINATION MOBILE NUMBER. [(country code) + mobile number] |
From | Yes | Eg:27126 | SHORT CODE NUMBER; PROVIDED BY WIRE2AIR |
Text | Yes | Wire2Air test message | The message text. Just like the other parameters, this should be urlencoded. It may contain any UTF-8 characters (Note: not all cell phone operators support UTF-8 characters). Check the encoding section for details. |
DeliveryDateTime | Optional | Example: 11/6/2010 7:41:06 PM EST (UTC date for 11/6/2010 3:41:06 PM) | Default: Now Date and time for message delivery in UTC MM/DD/YYYY HH:MM:SS format. |
Replypath | Optional | For example http://[yourserver]/smsreceiver.php? | Provide your application url to receive replies from user. |
Request Format
JSON
{
“to”: “12121234567”,
“from”: “27126”,
“deliverydatetime”: “8/14/2017 09:00:00 AM”,
“text”: “This is a sample text message”,
“replypath”: “http://yourserverurl/receivesms.asp”
}
Form Encoded
Response
HTTP Status Codes
201 | Success – A new message has been queued for delivery |
401 | Unauthorized – Authentication credentials are missing or incorrect |
400 | Bad Request– Request is not valid. An accompanying error message explains what’s missing. |
500 | Internal Server Error – Contact support |
Sample Error Response
{ "StatusCode": 703, "StatusMessage": "Text Message missing." }
Successful Response Samples
{ "Response": "Message Queued successfully", "URI": "v1/message/outbox/85582790", "ID": "85582790", "Type": "Out" }
How to send bulk text messages
To send a message to many recipients simultaneously pass mobile number as comma separated in the “To” Parameter
POST https://msgapi.wire2air.com/rest/v1/message
with the following parameters:
Parameters
Name | Required? | Examples | Description |
---|---|---|---|
To | Yes | 12121234567,12121234568,12121234569, 447700900012 | Comma seperated Mobile Numbers. [(country code) + mobile number] |
From | Yes | Eg:27126 | SHORT CODE NUMBER; PROVIDED BY WIRE2AIR |
Text | Yes | Wire2Air test message | The message text. Just like the other parameters, this should be urlencoded. It may contain any UTF-8 characters (Note: not all cell phone operators support UTF-8 characters). Check the encoding section for details. |
BatchName | Optional | Batch08152017 | *Internal Use for Reporting |
DeliveryDateTime | Optional | Example: 11/6/2010 7:41:06 PM EST (UTC date for 11/6/2010 3:41:06 PM) | Default: Now Date and time for message delivery in UTC MM/DD/YYYY HH:MM:SS format. |
Replypath | Optional | For example http://[yourserver]/smsreceiver.php? | Provide your application url to receive replies from user. |
Successful Response Sample
{ "Response": "BATCHJOB Saved successfully", "URI": "v1/batch/3a2139c4-6910-4716-a5f2-895231dba6eb", "ID": "3a2139c4-6910-4716-a5f2-895231dba6eb", "Type": "Batch" }