Send SMS message to one or several numbers. As a rule, messages are queued in the service and sent to the recipient instantly or after a couple of minutes.

Check their status on TurboSMS Admin Panel.

 

Syntax

function mIntegrationTurboSMSSend(const sMsg, sRecipients: string; var sJSONResponse: string): integer;

 

Parameters and return values

Parameter

Type

Value

sMsg

string

message text, maximum 1521 characters in Latin symbols or 661 symbols of Cyrillic text (10 segments);

sRecipients

string

message recipients, phone numbers in international format divided by comma, without leading "+" spaces, for example: "380504451213,380671234587";

sJSONResponse

string

JSON object, full response from the service.

 

Function result

-2

integration is off, enable it in the settings;

-5

message is too long;

-6

message is empty;

-7

list of message recipients is empty;

800, 801, 802, 803

message sent successfully, check the details in the full response from the service.

 

Example

Sending a text message to one phone number:

var
  iResult: integer;
  sJSONResponse: string;
begin
  iResult := mIntegrationTurboSMSSend('Test message from MyChat Server!', '380504452169', sJSONResponse);
  
  mLogScript('Result: ' + IntToStr(iResult), '');
  mLogScript(sJSONResponse, '');
end.

Script work result

[15:04:42] (Log "TurboSMSSend"): Result: 800

[15:04:42] (Log "TurboSMSSend"): {"response_code":800,"response_status":"SUCCESS_MESSAGE_ACCEPTED","response_result":[{"phone":"380504452169","message_id":"5a22ddb8-60a1-b053-dc5a-a5bf4bc6fdfa","response_code":0,"response_status":"OK"}]}

[15:04:42] (Run "TurboSMSSend"): Script operation time: 274 ms

[15:04:42] (Run "TurboSMSSend"): Script done successfully.

 

SMS sent from MyChat via TurboSMS

 

See also

Help page for TurboSMS service via HTTP API, commands, answers, possible errors

IntToStr

mLogScript