Sending SMS
When sending a message with the messages api call you have some different options. On this page you can see some examples of how to use the different options.
Format
GSM
Sending a normal message
A simple example
{ "message":{ "recipients": "+4512721272", "sender": "TEST", "message": "Hello world!" } }
A simple example with a number as sender
{ "message":{ "recipients": "+4512721272", "sender": "+4512345678", "message": "Hello world!" } }
An more advanced example using a lot of the available parameters
{ "message":{ "format": "GSM", "recipients": "1,+4512721272", "sender": "TEST", "message": "Hello world!", "status": true, "statusurl": "http://example.com/dlr.php", "returndata": "my-own-data", "class": 0 } }
Send a message to a list
{ "message":{ "recipients": "1", "sender": "Test", "message": "Hello world" } }
Send a time scheduled message to a list.
The message will be sent at 30-05-2015 10:00
{ "message":{ "recipients": "1", "sender": "Test", "message": "Hello world", "sendtime": "30-05-2015 10:00" } }
Send a message to more recipients
{ "message":{ "recipients": "1,+4512345678,+4522112497,3", "sender": "Test", "message": "Hello world" } }
UNICODE
To send speciality chars like chinese letters.
A normal message is 160 chars, but if you use unicode each message can only hold 70 chars
Send the text "ÛÑÎÇÔÐÊ"
{ "message":{ "recipients": "+4512345678", "sender": "TEST", "message": "ÛÑÎÇÔÐÊ", "format": "UNICODE", "charset": "UTF-8" } }
BINARY
With binary messages you can send special message like a nokia vCard or similar.
To send a binary message you need to define the body in hex and set udh
Example of a Bookmark to coolsms.com
{ "message":{ "recipients": "+4512345678", "sender": "TEST", "message": "01062D1F2B6170706C69636174696F6E2F782D7761702D70726F762E62726F777365722D626F6F6B6D61726B730081EA01016A0045C67F0187151103436F6F6C534D53000187171103687474703A2F2F636F6F6C736D732E636F6D00010101", "format": "BINARY", "udh": "0C05040B8423F00504C34FC002" } }
WAPPUSH (Deprecated)
Not all new Smartphones supports WAP, so this feature is not recommended for general use.
Send a link that is opened on the phone
You need to define pushurl as well as the other required parameters for WAPPUSH messages
Example of a link to coolsms.com
{ "message":{ "recipients": "+4512345678", "sender": "TEST", "message": "CoolSMS", "format": "WAPPUSH", "pushurl": "http://coolsms.com" } }
Charged messages
If you have access to send charged messages you need to define a price and contenttype
Send a message with a price
Price is 10dkk(1000) to a single number (NOTE: sender has to be a valid shortcode)
{ "message":{ "recipients": "+4512345678", "sender": "1272", "message": "Hello world", "price": 1000, "contenttype": 9, "invoicetext": "", "revenuetext":"SOMETHING" } }
Feeling lost? Click on this link! Portal page