Skip to end of metadata
Go to start of metadata

 

Send a text message to the specified recipient.

POST arguments

The following POST parameters should be used in a POST request.

ParameterValue
message

The textual content of the message to be sent.
Up to 612 characters (see Concatenationbelow) from the GSM alphabet. The SMS characters we can support are documented below. Please ensure that data is also encoded in UTF-8.

to

The recipient (or recipients) you are sending the message to. If you want to send to multiple numbers, use a comma delimited list. Try to include the international code, for example 44 in the UK.

originator

A string (up to 11 alpha-numeric characters) or an international mobile number (up to 16 digits) of the sender, to be displayed to the recipient, e.g. 447777123123 for a UK number.

email

Available to txtUs Enterprise customers only. Specifes the email address for incoming responses.
If you specify an email address, you must specify an originator that is a txtUs Enterprise number that is on your account, or you will get an error response.

validity

Optional. An integer from 1 to 72, indicating the number of hours during which the message is valid for delivery. Messages which cannot be delivered within the specified time will fail.

custom

Optional. An alpha-numeric string, 1-20 characters long, which will be used to 'tag' your outgoing message and will appear in delivery reports, thus facilitating fltering of reports.

schedule

Optional. The date/time to schedule the message for sending. ISO 8601 format. Scheduled messages will not use any credits until sent, however the API response will indicate the number of credits that will be used when the message is sent.

check_stop

If set to 'true', prior to sending the number(s) will checked against the STOP group.

username

The username of the source/master account, for authentication. Not required if you use HTTP Basic Authentication instead.

password

The password of the source/master account, for authentication. Not required if you use HTTP Basic Authentication instead.

mobile_number

The mobile number of the intended recipient, in international format, e.g. 447777123123. Only one number is allowed. To send a message to multiple recipients, you must call the API for each number.
This parameter will be maintained for backwards compatibility reasons. You should use the 'to' parameter.

Concatenation

If you exceed 160 characters you automatically invoke concatenation sending. This will mean that each message consists of a 153 character ‘chunk’, i.e. no longer 160 characters.
The extra characters are used to 'glue' the messages together.
Therefore a message that is 307 characters long will actually require 3 text messages to send (153 + 153 + 1). Although it will appear as one long message to the recipient, it will use 3 credits to send.

Supported Characters

Please note we expect the data to be encoded in UTF-8 so for example à is C3 A0

See supported characters.

What is the meaning of success or failure?

There is a diference between a successfully sent message, and a successful delivery. Successfully sending a message using the API only means that the number and message appear to be in the correct format and that the message was queued for sending – this does not mean that the destination number exists, or that the message was received by the recipient.

A delivery report – which you can retrieve through the deliveryReport resource – confrms to you what has actually happened to the message. This may change over time, e.g. a delivery report may show a 'PENDING' status for a message 10 minutes after the message was sent, but may show a 'DELIVERED' status after an hour.
The status of messages can change for up to 72 hours after the message was sent. Therefore you may prefer to wait for 72 hours after sending an SMS before trying to retrieve its delivery report.

Example successful response body XML:

Response meanings:

XML tag/attribute Meaning
message_id 

The unique ID of the message sent. You can use this ID to fnd the status of the sent message in the delivery report. For SCHEDULED messages (i.e. where you have specified a 'schedule' parameter in the POST variables), the ID will be zero.

scheduled_id 

The unique ID of the scheduled message. You can use this ID later to delete a previously scheduled message. Unless the message has been scheduled for a future date, the ID will be zero.

credits_used

The number of credits used to send the message. If the message is scheduled for future sending, this value indicates how many credits will be used when it is sent.

status

Values possible are SENT, QUEUED, or SCHEDULED. Indicates whether the message was put in a queue for processing as soon as resources allow (QUEUED), sent immediately (SENT), or scheduled for future sending at your request (SCHEDULED).

Specific errors:

CodeMeaning
1

Bad username or password.

2

You have zero credits.

3The originator is invalid or too long.
4

The originator is invalid or missing.

5

The message is invalid or too long.

6

You have insufcient credits to send this message.

7The message is invalid or missing.
8The message contains unsupported characters (these will be listed in the error message).
9

The mobile numbers are invalid or too short.

10

The mobile numbers are invalid or not an integer.

11

The validity value is out of range.

12

The custom value is non-alphanumeric or out of range.

13The mobile number is in a STOP group.
30Invalid email address format.
31

An email address was specified, but the originator specified was not a txtUs number on your account.

32If specified, the validity period (in hours) must be between 1 and 72 inclusive.
33If specified, the custom feld must be alpha-numeric and up to 20 characters in length.
34

The 'schedule' parameter is not in ISO 8601 date format.

Example error response body XML:

DTD for sms POST:

  • No labels