Rate this page:

SMS

Methods

SendSmsMessage

Copy URL

Sends an SMS message between two phone numbers. The source phone number should be purchased from Voximplant and support SMS (which is indicated by the is_sms_supported property in the objects returned by the GetPhoneNumbers Management API) and SMS should be enabled for it via the ControlSms Management API. SMS messages can be received via HTTP callbacks, see this article for details.

Available for roles

To call this method, make sure your service account has one of the following roles:

See Available Roles
Owner
Admin
Developer
CallsSMS
SendSmsMessage example

SendSmsMessage example

Send the SMS message with the text "Test message" from the phone number 447443332211 to the phone number 447443332212.

Parameters

  • source:

    string

    The source phone number

  • destination:

    string

    The destination phone number

  • sms_body:

    string

    The message text, up to 765 characters. We split long messages greater than 160 GSM-7 characters or 70 UTF-16 characters into multiple segments. Each segment is charged as one message

  • store_body:

    boolean

    Optional

    Whether to store outgoing message texts. Default value is false

Returns

  • result:

    number

  • message_id:

    number

    Message ID

  • fragments_count:

    number

    The number of fragments the message is divided into

A2PSendSms

Copy URL

Sends an SMS message from the application to customers. The source phone number should be purchased from Voximplant and support SMS (which is indicated by the is_sms_supported property in the objects returned by the /GetPhoneNumbers Management API) and SMS should be enabled for it via the /ControlSms Management API.

Available for roles

To call this method, make sure your service account has one of the following roles:

See Available Roles
CallsSMS
A2PSendSms example

A2PSendSms example

Send the SMS message with the text "Test message" from the phone number 447443332211 to the phone numbers 447443332212 and 447443332213.

Parameters

  • src_number:

    string

    The SenderID for outgoing SMS. Please contact support for installing a SenderID

  • dst_numbers:

    stringlist

    The destination phone numbers separated by semicolons (;). The maximum number of these phone numbers is 100

  • text:

    string

    The message text, up to 1600 characters. We split long messages greater than 160 GSM-7 characters or 70 UTF-16 characters into multiple segments. Each segment is charged as one message

  • store_body:

    boolean

    Optional

    Whether to store outgoing message texts. Default value is false

Returns

ControlSms

Copy URL

Enables or disables sending and receiving SMS for the phone number. Can be used only for phone numbers with SMS support, which is indicated by the is_sms_supported property in the objects returned by the GetPhoneNumbers Management API. Each incoming SMS message is charged according to the pricing. If enabled, SMS can be sent from this phone number via the SendSmsMessage Management API and received via the InboundSmsCallback property of the HTTP callback. See this article for HTTP callback details.

Available for roles

To call this method, make sure your service account has one of the following roles:

See Available Roles
Owner
Admin
Developer
Accountant
ControlSms example

ControlSms example

Enable work with SMS for phone number 447443332211.

Parameters

  • phone_number:

    string

    The phone number

  • command:

    string

    The SMS control command. The following values are possible: enable, disable

Returns

  • result:

    number

GetSmsHistory

Copy URL

Gets the history of sent and/or received SMS.

Available for roles

To call this method, make sure your service account has one of the following roles:

See Available Roles
Owner
Admin
Developer
Supervisor
Accountant
CallsSMS
GetSmsHistory example

GetSmsHistory example

Get messages that had been sent to number 12345678222 starting from March 1, 2019. Number of resulting rows is limited to 2.

Parameters

  • source_number:

    string

    Optional

    The source phone number

  • destination_number:

    string

    Optional

    The destination phone number

  • direction:

    string

    Optional

    Sent or received SMS. Possible values: 'IN', 'OUT', 'in, 'out'. Leave blank to get both incoming and outgoing messages

  • count:

    number

    Optional

    Maximum number of resulting rows fetched. Must be not bigger than 1000. If left blank, then the default value of 1000 is used

  • offset:

    number

    Optional

    The first N records are skipped in the output

  • from_date:

    timestamp

    Optional

    Date from which to perform search. Format is 'yyyy-MM-dd HH:mm:ss', time zone is UTC

  • to_date:

    timestamp

    Optional

    Date until which to perform search. Format is 'yyyy-MM-dd HH:mm:ss', time zone is UTC

  • output:

    string

    Optional
    Defaults on:  json

    The output format. The following values available: json, csv

Returns

  • total_count:

    number

    Total number of messages matching the query parameters

A2PGetSmsHistory

Copy URL

Gets the history of sent/or received A2P SMS.

Available for roles

To call this method, make sure your service account has one of the following roles:

See Available Roles
Owner
Admin
CallsSMS
A2PGetSmsHistory example

A2PGetSmsHistory example

Get messages that had been sent to number 12345678222 starting from March 1, 2019. Number of resulting rows is limited to 2.

Parameters

  • source_number:

    string

    Optional

    The source phone number

  • destination_number:

    string

    Optional

    The destination phone number

  • count:

    number

    Optional

    Maximum number of resulting rows fetched. Must be not bigger than 1000. If left blank, then the default value of 1000 is used

  • offset:

    number

    Optional

    The first N records are skipped in the output

  • from_date:

    timestamp

    Optional

    Date from which the search is to start. Format is 'yyyy-MM-dd HH:mm:ss', time zone is UTC

  • to_date:

    timestamp

    Optional

    Date from which the search is to end. Format is 'yyyy-MM-dd HH:mm:ss', time zone is UTC

  • output:

    string

    Optional
    Defaults on:  json

    The output format. The possible values are json, csv

  • delivery_status:

    number

    Optional

    The delivery status ID: QUEUED - 1, DISPATCHED - 2, ABORTED - 3, REJECTED - 4, DELIVERED - 5, FAILED - 6, EXPIRED - 7, UNKNOWN - 8

Returns

  • total_count:

    number

    Total number of messages matching the query parameters