Sending SMS
Description
When sending messages, all calls to the API must be made via URL:
http://www.webtext.com/api/send_text.html
or, to use SSL:
https://www.webtext.com/api/send_text.html
Mandatory Parameters when sending messages
|
api_id |
This is your WebTEXT API id, unique to your WebTEXT account. Issued on request by WebTEXT (support@webtext.com). Note that this is NOT your WebTEXT user name. |
|
api_pwd |
API password, as issued to you by WebTEXT. |
|
dest |
The destination phone number, expressed in international format, without leading +. A UK number would appear as 4471234567. This parameter may contain ONLY the digits 0-9 and comma, where multiple numbers are specified. The API will accept multiple, comma-delimited mobile numbers, as destinations for a single message. A maximum of 500 numbers can be included in a single HTTP request. Sending to a Contact Group: Specify the alias for the group instead of any phone numbers. Eg: 888654321 is a group alias. Specific alias can be found on the Manage Contact Groups page. |
|
txt |
This is the text to be sent. Maximum length 160 characters. |
Mandatory Parameters when sending UNICODE messages
|
api_id |
This is your WebTEXT API id, unique to your WebTEXT account. Issued on request by WebTEXT (support@webtext.com). Note that this is NOT your WebTEXT user name. |
|
api_pwd |
API password, as issued to you by WebTEXT |
|
dest |
The destination phone number, expressed in international format, without leading +. A UK number would appear as 4471234567. This parameter may contain ONLY the digits 0-9 and comma, where multiple numbers are specified. The API will accept multiple, comma-delimited mobile numbers, as destinations for a single message. A maximum of 500 numbers can be included in a single HTTP request. |
|
unicode |
This need to be set to 1 to indicate a unicode message |
|
hex |
This is a hexadecimal string of UTF16 (big endian) characters. Each character is represented by 2 bytes. Example: ABC = 004100420043 Hello = 00480065006C006C006F Generating the required hex string using PHP, starting with a string in UTF8 charset. <? $utf8="Hello World"; $utf16=iconv('UTF-8','UTF-16BE',$utf8); $tmp=unpack('H*hex',$utf16); $hex="{$tmp['hex']}"; echo "$utf8 -> $hex"; ?> should produce output as follows: Hello World -> 00480065006c006c006f00200057006f0072006c0064 |
Optional Parameters when sending messages
|
tag |
This is the alphanumeric* tag which you wish to attach to the outgoing message. Maximum length 11 characters. If 'tag' is not specified, the message will be sent from your Virtual Number, or from a shared Virtual Number if you do not have your own. * To be precise, the 'tag' paramater can use any character which is part of the 7-bit default alphabet as specified by GSM 03.38. This would include the following: @ £ $ ¥ è é ù ì ò Ç Ø ø Å å _ Æ æ ß É ! " # ¤ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? ¡ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Ä Ö Ñ Ü § ¿ a b c d e f g h i j k l m n o p q r s t u v w x y z ä ö ñ ü à <SPACE> Note, however, that some carriers have issues with some of the less common characters, and testing the required tag is to be recommended. |
|
delivery_time |
This is 12-digit numerical value, specifying the time (GMT) at which the message should be delivered. Format for value is yyyymmddhhmm (example '200612141305' = Dec 14 2006 13:05) |
|
delivery_delta |
This parameter is numerical, and specifies the number of minutes in the future when the message is to be delivered. This allows the calling application to specify a specific delay in minutes prior to attempting delivery of the message. It negates any issues which might arise with timezones etc. |
|
receipt |
Action required on arrival of a delivery receipt related to this message. May be 0 (default), 1 or 2. 0 – No receipt forwarding required 1 – Forward receipt to a URL 2 – Forward receipt to an email address |
|
msgid |
This is a numerical value, provided by the client. When a delivery receipt is forwarded to the client, this id will be quoted to allow the client associate the receipt with a particular sent message. |
|
receipt_url |
This is the URL to which delivery receipts for this message should be sent. The client must have the necessary script set up at this url to deal with the forwarded receipt. Mandatory when receipt=1. |
|
receipt_email |
This is the email address to which delivery receipts for this message will be forwarded. Mandatory when receipt=2. |
|
validity |
The validity period, in minutes, for this message. May range between 1 and 2880 (2 days) inclusive. Some carriers will set a maximum value of 1440 (1 day) If a message has not been delivered to the intended recipient after <validity> minutes, the network will not attempt to deliver it at all. This is useful where information has a short currency/lifespan. |
Usage Examples
- Sending a Message for immediate delivery
This is a sample GET request, sending the text 'test message' to 4471234567, with alphanumeric tag 'my test':
- Sending a Message for immediate delivery to multiple recipients
This is a sample GET request, sending the text 'test message' to 4471234567 and 353861234567, with alphanumeric tag 'my test':
- Sending a Message for immediate delivery to a Contact Group
This is a sample GET request, sending the text 'test message' to a contact group with group alias= 888123456, (as found under 'Manage Contact Groups' when logged into the WEBTEXT.COM site) with alphanumeric tag 'my test':
http://www.webtext.com/api/send_text.html?api_id=myid&api_pwd=mypwd&txt=test%20message&dest=888123456&tag=my%20test
- Scheduling a Message for later delivery
This is a sample GET request, sending the text 'test message' to 4471234567, with tag 'my test', to be delivered on January 18th 2012 at 11:30 AM:
This is a sample GET request, sending the text 'test message' to 4471234567, with tag 'my test', to be delivered in 15 minutes, with a 2 hour validity period:
http://www.webtext.com/api/send_text.html?api_id=myid&api_pwd=mypwd&txt=test%20message&dest=4471234567&tag=my%20test&delivery_delta=15&validity=120
- Sending a Unicode Message
This is a sample GET request, sending the text 'Hello World', in Unicode, to 601234567,
with alphanumeric tag 'my test':
http://www.webtext.com/api/send_text.html?api_id=myid&api_pwd=mypwd&unicode=1&hex=00480065006c006c006f00200057006f0072006c0064&dest=601234567&tag=my%20test
