In my example I am trying to send a SMS message to a mobile number using Resco’s InvokeWebRequest.
There are 4 parts to constructing the ‘InvokeWebRequest’ function.
- Method – To send a data to an API server. We will need to use the POST method in order to send the SMS message
- URL – I was using ‘The SMS Works’ as my SMS service which uses a URL of – https://api.thesmsworks.co.uk/v1/message/send to send SMS messages
- Headers – The Headers need to be created as a StringList variable. You will need to add each header to the StringList variable by using the ‘AddItem’ function. (Make sure that each header has a space after the colon e.g. Content-Type: application/json)
- Body – This is where you need to input the JSON object of what data you are trying to send. In this case my SMS service expects 3 properties. Sender, Destination and Content.
As each SMS service is different in terms of how they send SMS messages, I suggest that you review the documentation of the service you are using and construct the web request in ‘Postman‘ first so you can test your request before creating the process in Resco.
Method
POST
URL
https://api.thesmsworks.co.uk/v1/message/send
Header
Authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9........
Content-Type: application/json
Below is an example on how to construct the Headers variable into the ‘InvokeWebRequest’.
Body
{
"sender": "DDynamics",
"destination": "12345678910",
"content": "This SMS Works"
}
Below is an example on how to construct the Body variable into the ‘InvokeWebRequest’. In this case I am inserting dynamic variables into the Body so dynamic SMS messages can be sent.