SMS

Methods

ControlSms

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.

Parameters

  • phone_number:

    string

    The phone number.

  • command:

    string

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

Returns

  • result:

    number

Examples

request:

Enable work with SMS for phone number 447443332211.

https://api.voximplant.com/platform_api/ControlSms/?account_id=1&api_key=eec36d6c-a0eb-46b5-a006-1c2b65343bac&phone_number=447443332211&command=enable

Disable work with SMS for phone number 447443332211.

https://api.voximplant.com/platform_api/ControlSms/?account_id=1&api_key=eec36d6c-a0eb-46b5-a006-1c2b65343bac&phone_number=447443332211&command=disable

response:

{
    "result": 1
}

GetSmsHistory

Get history of sent and/or received SMS.

Parameters

  • Follow link for authentication parameter names and details.

  • 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
    OPTIONALDEFAULTS TO:  json

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

Returns

  • result:

    [ SmsHistoryType ]
  • total_count:

    number

    Total number of distinct messages fetched.

Examples

request:

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

https://api.voximplant.com/platform_api/GetSmsHistory/?account_id=5&api_key=18cb2d29-6091-4009-a5a2-730d573211f5&destination_number=12345678222&row_limit=2&from_date=2019-03-01%2000%3A00%3A00

response:

{
    "result": [
        {
            "cost": 4.3437,
            "sms_id": 1,
            "direction": "IN",
            "fragments": 1,
            "status_id": "2",
            "error_message": "Some error message text here",
            "source_number": "12345678111",
            "processed_date": "2019-03-11 21:00:00",
            "destination_number": "12345678222"
        },
        {
            "cost": 2.7123,
            "sms_id": 3,
            "direction": "IN",
            "fragments": 1,
            "status_id": "1",
            "source_number": "12345678111",
            "processed_date": "2019-06-04 21:00:00",
            "transaction_id": 3333,
            "destination_number": "12345678222"
        }
    ],
    "total_count": 2
}

SendSmsMessage

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.

Parameters

  • source:

    string

    The source phone number.

  • destination:

    string

    The destination phone number.

  • sms_body:

    string

    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 to which the message divided.

Examples

request:

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

https://api.voximplant.com/platform_api/SendSmsMessage/?account_id=1&api_key=eec36d6c-a0eb-46b5-a006-1c2b65343bac&source=447443332211&destination=447443332212&sms_body=Test%20message

response:

{
    "result": 1,
    "fragments_count": 1
}