Solved CFD - Web Service Rest

Status
Not open for further replies.

mason.gomes

Customer
Basic Certified
Joined
Jun 2, 2021
Messages
6
Reaction score
3
Hi,

I am fairly new to call flow apps. The only experience I have with them is time based routing, which was easy to set up. I am now trying to utilize the web service rest tool, but I am having some issues. I hope someone can give me some guidance.

I am trying to set up a http request to Twilio to send the caller a SMS message from a Twilio number. I am not quite sure how to format the content in the expression builder. This is what I have. (FYI I from phone number is not my actual number. I just used +1 555 555 5555 so I didn't have to post my actually number in the forum. ;)
1623184902753.png
The expression builder from above spits out this content....I know I am doing something wrong, I just don't know what.
CONCATENATE("\"To=+1\"",session.ani,"From=+15555555555","Body=Hello World!")

The code from Twilio looks like the following. I have tested with my credentials and phone numbers and it works in a terminal....
curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages.json \
--data-urlencode "To=+13105555555" \
--data-urlencode "From=+12125551234" \
--data-urlencode "Body=Hello from my Twilio line!" \
-u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'


3CX Pro - Debian hosted in AWS Ligtsail.

Any input or feedback is appreciated! Thanks! :)
 
  • Like
Reactions: _aMiCiCi_
From your curl command, you need to send the data as URL encoded form data. That means that the content body should look like:
To=+13105555555&From=+12125551234&Body=Hello from my Twilio line!

Then, the expression for the Content should be:
CONCATENATE("To=+1",session.ani,"&From=+12125551234&Body=Hello from my Twilio line!")

The parameters you're specifying with -u are the user and password. You will need to set them for Basic Authentication.
 
  • Like
Reactions: _aMiCiCi_
Perfect. Worked like a charm Thank you!
 
  • Like
Reactions: edossantos
Status
Not open for further replies.

Members Online Now

No members online now.

Forum statistics

Threads
111,831
Messages
589,277
Members
164,660
Latest member
RJenkinsROCK