How to Send SMS Messages using cURL

Prerequisites

  1. A Movider account. If you don’t have one, please sign up first.
  2. API key and API secret.
  • Login to Movider member section.
  • Go to Settings.
  • At API Settings tab, you can see your API key and API secret. Toggle visibility of API secret using the eye button on the right.
1084

Login to Movider member section.

2880

Go to Settings, then you can see your
API key and API secret at API Settings tab.

Sending SMS Messages using cURL

Take API key and API secret from prerequisite steps, make a request using cURL as shown in below example.

curl -X "POST" https://api.movider.co/v1/sms \
     -d to=6678901234 \
     -d text="Hello from Movider" \
     -d api_key=1KDFRBMfpbf8184RghTlffnbGT5 \
     -d api_secret=tzp99FCPR89o9rMJ••••••••••••••••••••••••

This example request includes required parameters which are to, text, api_key, and api_secret. More detail explanation and other available optional parameters could be found in API References.

Then you will get the response including your remaining balance, the amount of messages in the request, phone number list that could be sent along with its message ID, as well as bad phone number list that could not be sent along with its reason of failure. See an example of response below.

{
    "remaining_balance": 119.74498245,
    "total_sms": 1,
    "phone_number_list": [
        {
            "number": "66847827374",
            "message_id": "4rnciKXyi7qzN8HRqzjoXU",
            "price": 0.075,
        }
    ],
    "bad_phone_number_list": [
        {
            "number": "141555526711",
            "msg": "Invalid number or Not region code."
        },
        {
            "number": "65812263711",
            "msg": "Invalid number or Not region code."
        }
    ]
}
<xml>
    <remaining_balance>119.74498245</remaining_balance>
    <total_sms>1</total_sms>
    <phone_number_list>
        <number>66847827374</number>
        <message_id>4rnciKXyi7qzN8HRqzjoaV</message_id>
      	<price>0.075</price>
    </phone_number_list>
    <bad_phone_number_list>
        <number>141555526711</number>
        <msg>Invalid number or Not region code.</msg>
    </bad_phone_number_list>
    <bad_phone_number_list>
        <number>65812263711</number>
        <msg>Invalid number or Not region code.</msg>
    </bad_phone_number_list>
</xml>

The default format of the response is JSON, but you can set it to application/xml for XML using Accept Headers in your request. See more detail in API References.

If you didn’t get the response as expected, please see the Error table in API References for troubleshooting.