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.

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

Returns

  • result:

    number

  • fragments_count:

    number

    The number of fragments the message was 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.

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 source phone number

  • dst_numbers:

    stringlist

    The destination phone numbers separated by the ';' symbol

  • 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

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 inbound SMS message is charged according to the pricing. If enabled, SMS can be sent from this phone number using the SendSmsMessage Management API and received using the InboundSmsCallback property of the HTTP callback. See this article for HTTP callback details.

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.

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 more than 1000. If left blank, then the default value of 1000 will be used

  • offset:

    number

    Optional

    The first N records will be skipped in the output

  • from_date:

    timestamp

    Optional

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

  • to_date:

    timestamp

    Optional

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

  • 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.

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 more than 1000. If left blank, then the default value of 1000 will be used

  • offset:

    number

    Optional

    The first N records will be skipped in the output

  • from_date:

    timestamp

    Optional

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

  • to_date:

    timestamp

    Optional

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

  • 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