Message-ID: <1547421758.15897.1614958654900.JavaMail.confluence@wiki> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_15896_1837903730.1614958654900" ------=_Part_15896_1837903730.1614958654900 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Send a text message to the specified recipient. Optionally, sends can be= scheduled.
See also What is a s= ent message?
With the minimum arguments required, sends 'my message' to 447000000000 = with sender ID 'Sender':
Hashtable result =3D tmClient.sendSMS("My message", "447= 000000000", "Sender", 72, "", "", null); Console.WriteLine("Used {0} Credits, ID:{1}, Status: {2}", result= ["credits_used"],=20 result["message_id"], result["status"]);=20
As above, but sets validity to 72 hours and is scheduled for sending on = 1st Jan 2013 at 01:00 GMT:
Hashtable result =3D tmClient.sendSMS("My message", "447= 000000000", "Sender", 72, "", "myTag", n= ew DateTime(2013, 1, 1, 1, 0, 0)); Console.WriteLine("Used {0} Credits, ID:{1}, Status: {2}", result= ["credits_used"], result["scheduled_id"], result["= status"]);=20
Arguments:
String message:
the textual content of the message to be sent. Up to 612 characters from= the GSM alphabet. See Supported Characters for t= he characters we support. Please ensure messages are encoded in UTF-8.
String mobile_number:
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.
String originator:
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.
int validity:
an integer from 1 to 72 (the default), indicating the number of hours du= ring which the message is valid for delivery. Messages which cannot be deli= vered within the specified time will fail.
String email:
(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.
String custom:
(optional) an alpha-numeric string, 1-20 characters long, which will be = used to 'tag' your outgoing message and will appear in delivery report= s, thus facilitating filtering of reports (see getDeliveryReport function)
Date schedule:
(optional) date to schedule the message to be sent at a given time (Euro= pe/London time)
Returns:
A Hashtable with 4 keys: 'message_id', 'scheduled_id', 'credits_us=
ed', 'status' e.g.
result["credits_used"]
Hashtable 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 messag= e. You can use this ID later to delete a previously scheduled message. Unle= ss the message has been scheduled for a future date, the ID will be zero. |
credits_used | Integer. The number of credits used to send t= he message (up to 3 for UK or 6 for international). If the message is sched= uled for future sending, 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 processing = as soon as resources allow (QUEUED), sent immediately (SENT), or scheduled = for future sending at your request (SCHEDULED) |
Specific error codes:
Code | Meaning |
---|---|
0 | Refused (bad number or trying international s= ending 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) mus= t 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 d= ate format. |