Send Your First Message¶
endpoint v.2: /api/v2/sms
endpoint v.1: /api/messages
Prerequisites¶
Before you send an SMS message using the /api/v2/sms endpoint, make sure you have:
- A Live Link 365 Account
- A cURL installation on your computer
- An app key and a secret associated to your Live Link 365 account
- An OAuth token which will confirm your identity to the Live Link 365 endpoint
Getting an App Key and a Secret
Please refer to this site's Authentication section to get an app key, a secret, and an OAuth token
Steps¶
Once you have all the prerequisites (especially the OAuth token), follow these steps to send an SMS message using cURL:
- Open a new command prompt (or a terminal if you're using Mac).
-
Write a curl command. Make sure you add the following:
- A POST method
- An Authorization header with your bearer token
- A Content-Type header that specifies the data will be in application/json format
- A body with the following properties (optional properties between brackets):
Property Value message The SMS text message's content destination Array of recipient numbers. If only one number, you can send it as a single element array or just as a single string [origin] Number that will be considered the message sender. It can be a short code, a long code, or an alphanumeric code as long as it belongs to your account's registered numbers. This number will be the one to receive MO replies once the message is sent Payload Properties
This guide shows you only some of the properties that the JSON payload can carry. To see the complete JSON structure, please visit this site's Sending SMS section
Code Formats
If you will use a long code as the origin, it must be prefixed with its respective country code.
Other code formats, on the other hand, must not be prefixedThe command should look like this:
curl -X POST \ -H "Authorization: Bearer yourToken" \ -H "Content-Type: application/json" \ -d '{"destination": ["YOUR-MOBILE-NUMBER"], "message": "My First Live Link 365 SMS"}' \ https://livelink.sapdigitalinterconnect.com/api/v2/sms
curl -X POST ^ -H "Authorization: Bearer yourToken" ^ -H "Content-Type: application/json" ^ -d "{\"destination\": [\"YOUR-MOBILE-NUMBER\"], \"message\": \"My First Live Link 365 SMS\"}" ^ https://livelink.sapdigitalinterconnect.com/api/v2/sms
Copying the Command
After you copy the command, make sure you replace all placeholders with appropriate values before pasting it into any command-line interface
-
Press Enter. cURL will produce some output and will then display the endpoint's response.
-
You should get a response like the one described below:
Property Value livelinkOrderIds Object containing the destination and livelinkOrderId properties below destination Number to which the message was sent livelinkOrderId List of unique identifiers for the send-message request. If SMS message splitting occurs (usually when message is longer than 160 characters), there will be one order ID for each part sent The following JSON object shows the hierarchical structure of the payload's properties mentioned above:
{ "livelinkOrderIds": [ { "destination": [ "123...789" ], "livelinkOrderId": [ "123456789", "123456777" ] }, { "destination": [ "456...789" ], "livelinkOrderId": [ "1453217689", "153256777" ] } ] }
Congratulations! You just sent your first SMS message using the Live Link 365 API's version 2 SMS endpoint.
About the SMS Version 2 Endpoint
Please visit the our API Reference section for more information on endpoint parameters and response payloads