Rate this page:

SMS

Methods

SendSmsMessage

Copy URL

Send 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 HTTP API) and SMS should be enabled for it via the ControlSms HTTP 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

    Optional

    The source phone number.

  • destination:

    string

    Optional

    The destination phone number.

  • sms_body:

    string

    Optional

    The message text, up to 70 characters. The message of 71-140 characters is billed like 2 messages; the message of 141-210 characters is billed like 3 messages and so on.

Returns

  • result:

    number

  • fragments_count:

    number

    The number of fragments the message was divided into.

A2PSendSms

Copy URL

Send 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 HTTP API) and SMS should be enabled for it via the /ControlSms HTTP 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

    Optional

    The source phone number.

  • dst_numbers:

    stringlist

    Optional

    The destination phone numbers separated by the ';' symbol.

  • text:

    string

    Optional

    The message text, up to 1600 characters.

Returns

ControlSms

Copy URL

Enable or disable SMS sending and receiving 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 HTTP API. Each inbound SMS message is billed according to the pricing. If enabled, SMS can be sent from this phone number using the SendSmsMessage HTTP 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

    Optional

    The phone number.

  • command:

    string

    Optional

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

Returns

  • result:

    number

GetSmsHistory

Copy URL

Get 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 distinct messages fetched.

A2PGetSmsHistory

Copy URL

Get 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