BigEfromDaBX 25 Posted May 21, 2019 Report Share Posted May 21, 2019 How do i get this twilio code to work with HTTP POST curl -X POST https://studio.twilio.com/v1/Flows/FWxxxxxxxxxxxxxxxxxxxxx/Executions \ -d "From=+12345678900" \ -d "To=+15556667777" \ -u ACyyyyyyyyyyyyyyyyyyyyy:zzzzzzzzzzzzzzzzzz Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted May 21, 2019 Report Share Posted May 21, 2019 plugin command("HTTP post.dll", "http set headers", "u", "ACCOUNT-SID:Auth-Token")set(#send message,$plugin function("HTTP post.dll", "$http post", "https://api.twilio.com/2010-04-01/Accounts/ACCOUNT-SID/Messages.json?From={$plugin function("HTTP post.dll", "$http text encoder", "url encode", "+19798885555")}&To={$plugin function("HTTP post.dll", "$http text encoder", "url encode", "+19895552222")}&Body={$plugin function("HTTP post.dll", "$http text encoder", "url encode", "this is the message to send")}", "", "", "", "", ""),"Global") Think this will get it done for you Quote Link to post Share on other sites
BigEfromDaBX 25 Posted May 22, 2019 Author Report Share Posted May 22, 2019 (edited) plugin command("HTTP post.dll", "http set headers", "u", "ACCOUNT-SID:Auth-Token")set(#send message,$plugin function("HTTP post.dll", "$http post", "https://api.twilio.com/2010-04-01/Accounts/ACCOUNT-SID/Messages.json?From={$plugin function("HTTP post.dll", "$http text encoder", "url encode", "+19798885555")}&To={$plugin function("HTTP post.dll", "$http text encoder", "url encode", "+19895552222")}&Body={$plugin function("HTTP post.dll", "$http text encoder", "url encode", "this is the message to send")}", "", "", "", "", ""),"Global") Think this will get it done for you Thanks TJ. I appreciate your help I copied the code form your post but the twilio URL was cut off. Funny because when I quote your post it shows correctly. Anyways. After I fixed i get a an error "The remote server returned an error: (401) Unauthorized." I tried over and over to get it working but I cant get passed that Unauthorized error. I dont quite understand the HTTP set headers command. When does that get passed over. I did use my credentials btw and when I copy the url variable and paste it into my browser it prompts me for the username and password which i enter the AC and auth. Doesnt send message but I can view my past messages that I sent See my modified code below. clear all data set(#ACCOUNT SID,"AC0000000000000000","Global") set(#AUTH TOKEN,"AAAAAAAAAAAAAAAAAAA","Global") set(#From,"+12125551212","Global") set(#To,"+12125551313","Global") set(#Body,"This is a Test","Global") set(#url,"https://api.twilio.com/2010-04-01/Accounts/{#ACCOUNT SID}/Messages.json?From={$plugin function("HTTP post.dll", "$http text encoder", "url encode", #From)}&To={$plugin function("HTTP post.dll", "$http text encoder", "url encode", #To)}&Body={$plugin function("HTTP post.dll", "$http text encoder", "url encode", #Body)}","Global") plugin command("HTTP post.dll", "http set headers", "u", "{#ACCOUNT SID}:{#AUTH TOKEN}") set(#send message,$plugin function("HTTP post.dll", "$http post", #url, "", "", "", "", ""),"Global") Below is a snapshot as well Thanks in advance. Edited May 22, 2019 by BigEfromDaBX Quote Link to post Share on other sites
BigEfromDaBX 25 Posted May 24, 2019 Author Report Share Posted May 24, 2019 I was also told by twilio that you can authenticate by using the following method below. But still not having any luck. https://ACxxxxxxxxxxxxxx:yyyyyyyyyyyyyyyy@studio.twilio.com/v1/Flows Quote Link to post Share on other sites
HelloInsomnia 1103 Posted May 30, 2019 Report Share Posted May 30, 2019 Try this clear all data set(#ACCOUNT SID,"AC0000000000000000","Global") set(#AUTH TOKEN,"AAAAAAAAAAAAAAAAAAA","Global") set(#From,"+12125551212","Global") set(#To,"+12125551313","Global") set(#Body,"This is a Test","Global") set(#url,"https://api.twilio.com/2010-04-01/Accounts/{#ACCOUNT SID}/Messages.json","Global") set(#parameters,"From={$plugin function("HTTP post.dll", "$http text encoder", "url encode", #From)}&To={$plugin function("HTTP post.dll", "$http text encoder", "url encode", #To)}&Body={$plugin function("HTTP post.dll", "$http text encoder", "url encode", #Body)}","Global") plugin command("HTTP post.dll", "http set headers", "u", "{#ACCOUNT SID}:{#AUTH TOKEN}") set(#send message,$plugin function("HTTP post.dll", "$http post", #url, #parameters, "", "", "", ""),"Global") Quote Link to post Share on other sites
BigEfromDaBX 25 Posted May 31, 2019 Author Report Share Posted May 31, 2019 Try this clear all data set(#ACCOUNT SID,"AC0000000000000000","Global") set(#AUTH TOKEN,"AAAAAAAAAAAAAAAAAAA","Global") set(#From,"+12125551212","Global") set(#To,"+12125551313","Global") set(#Body,"This is a Test","Global") set(#url,"https://api.twilio.com/2010-04-01/Accounts/{#ACCOUNT SID}/Messages.json","Global") set(#parameters,"From={$plugin function("HTTP post.dll", "$http text encoder", "url encode", #From)}&To={$plugin function("HTTP post.dll", "$http text encoder", "url encode", #To)}&Body={$plugin function("HTTP post.dll", "$http text encoder", "url encode", #Body)}","Global") plugin command("HTTP post.dll", "http set headers", "u", "{#ACCOUNT SID}:{#AUTH TOKEN}") set(#send message,$plugin function("HTTP post.dll", "$http post", #url, #parameters, "", "", "", ""),"Global") Thanks Nick. But im still getting the same error: #send message: The remote server returned an error: (401) Unauthorized. I got it working with the python plugin that I downloaded from TJ. I appreciate your help. 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.