Message-ID: <846036494.15819.1614958298661.JavaMail.confluence@wiki> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_15818_1874003616.1614958298661" ------=_Part_15818_1874003616.1614958298661 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html sendSMS

sendSMS

=20
=20
=20
=20

 

=20
=20
=20
=20
=20
=20

Send a text message to the specified recipient. Optionally, sends can be= scheduled.
See also What is a sent message?

=20
=20
=20
=20
=20
=20

With the minimum arguments required, sends 'my message' to 447000000000 = with sender ID 'Sender':

Example
=20
$result =3D $tmClient->sendSMS('My message', '447000000000', 'Sende=
r');
echo "Used {$result['credits_used']} credits, message ID {$result['mes=
sage_id']}";
=20
=20
=20
=20
=20
=20
=20

As above, but sets validity to 72 hours and is scheduled for sending on = 1st Jan 2013 at 01:00 GMT:

Example
=20
$result =3D $tmClient->sendSMS('My message', '447000000000', 'Sende=
r', 72, null, 'myTag', '2013-01-01T01:00:00+00:00');
echo "Used {$result['credits_used']} credits, scheduled ID {$result['s=
cheduled_id']}";
=20
=20
=20
=20
=20
=20
=20

Arguments:

=20
=20
=20
=20

 

=20
=20
=20
=20
=20
=20

string $message: 

=20
=20
=20
=20

the textual content of the message to be sent. Up to 612 characters from= the GSM alphabet. See Supported Characters below for the characters we sup= port. Please ensure messages are encoded in UTF-8.

=20
=20
=20
=20
=20
=20

string $mobile_number: 

=20
=20
=20
=20

the mobile number of the intended recipient, in international format, e.= g. 447000000000. Only one number is allowed. To send a message to multiple = recipients, you must call the function for each number.

=20
=20
=20
=20
=20
=20

string $originator:

=20
=20
=20
=20

sender ID: text (up to 11 alpha-numeric characters) or the international= mobile number (up to 16 digits) of the sender, to be displayed to the reci= pient, e.g. 447777123123 for a UK number.

=20
=20
=20
=20
=20
=20

integer $validity: 

=20
=20
=20
=20

(optional) an integer from 1 to 72 (the default), indicating the number = of hours during which the message is valid for delivery.
Messages whi= ch cannot be delivered within the specified time will fail.

=20
=20
=20
=20
=20
=20

string $email:

=20
=20
=20
=20

(optional) available to txtUs Plus customers only. Specifies the email a= ddress for incoming responses. If you specify an email address, you must sp= ecify an originator that is a txtUs Plus number that is on= your account, or you will get an error response.

=20
=20
=20
=20
=20
=20

string $custom:

=20
=20
=20
=20

(optional) an alpha-numeric string, 1-20 characters long, which will be = used to 'tag' your outgoing message and will appear in delivery reports, th= us facilitating filtering of reports (see getDeliveryReport function)

=20
=20
=20
=20
=20
=20

string $schedule:

=20
=20
=20
=20

(optional) date to schedule the message to be sent at a given time (Euro= pe/London time), should be in ISO 8601 format or a Unix timestamp

=20
=20
=20
=20
=20
=20

Supported Characters:

=20
=20
=20
=20

When constructing the message to be sent you should be aware that not al= l characters are supported by the GSM networks. They have a specific charac= ter set that they use. It shouldn=E2=80=99t be of concern to 99% of people = since the English alphabet is supported, plus some common accented characte= rs.
Please note we expect the data to be encoded in UTF-8. You will ne= ed to convert your message first if you are using a different character set= , for example people sometimes store message templates in databases in one = of the latin character sets. If you are storing messages in a database you = may need to check the basic character set.

=20
=20
=20
=20
=20
=20

Returns:

an array with 4 keys: 'message_id', 'scheduled_id', 'credits_used', 'sta= tus' e.g. $result['message_id']

=20
=20
=20
=20
Array key Value
message_id 

Integer. The unique ID of the message sent. Y= ou can use this ID to find the status of the sent message in a delivery rep= ort. However for scheduled messages (i.e. where you have specified a 'sched= ule' argument), the ID will be zero.

 scheduled_id String. = The unique ID of the scheduled message. You can use this ID later to delete a previously scheduled mess= age. Unless the message has = been scheduled for a future date, the ID will be zero.
 credits_used  Integer.= The number of credits used to send the message (up to 3 for UK or 6 for international). If the message= is scheduled for future sen= ding, this value indicates how many credits will be used when it is = sent.
 status  String. = Values possible are SENT, QUEUED, or SCHEDULED. Indicates whether the message was put in a queue for pr= ocessing as soon as resource= s allow (QUEUED), sent immediately (SENT), or scheduled for future sending at your request (SCHEDULED).=
=20
=20
=20
=20
=20
=20

Specific error codes:

=20
=20
=20
=20
Code Meaning
0 Refused (bad number or trying international send= ing without a valid account).
1 Bad username or password.
2

You have zero credits.

3 The originator is invalid or too long.
4 The originator is invalid or missing.
5 The message is invalid or too long.
6 You have insufficient credits to send this messa= ge.
7 The message is invalid or missing.
8 The message contains unsupported characters (the= se will be listed in the error message).
9 The mobile number is invalid or too short.
10 The mobile number is invalid or not an integer.<= /td>
30

Invalid email address format.

31

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

32

If specified, the validity period (in hours) = must be between 1 and 72 inclusive.

33 If specified, the custom field must be alpha-num= eric and up to 20 characters in length.
34 The 'schedule' parameter is not in= ISO 8601 date format.
=20
=20
=20
=20
=20
=20

 

=20
=20
=20
=20

 

=20
=20
=20
=20
=20
=20
=20
=20
=20
=20

 

=20
=20
=20
=20

 

=20
=20
=20
=20
=20
=20
=20

You must know!

=20 =20

Our example code is an illustra= tion of how you might integrate with our systems and is not certified for p= roduction environments. You are responsible for testing and QA.

=20
=20
=20
=20
=20
------=_Part_15818_1874003616.1614958298661--