PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WD20] TWILIO --- HTTP, WEB SERVICE, REST or ALL THREE?
[WD20] TWILIO --- HTTP, WEB SERVICE, REST or ALL THREE?
Débuté par Paul Murray, 07 fév. 2016 01:24 - 4 réponses
Posté le 07 février 2016 - 01:24
Greetings all,

We use Twilio to send out SMS messages and we have a call back URL that Twilio connects to on our server to tell us if the message was delivered and also to handle SMS replies from our clients.

I realized today that one of our vendors is sending out SMS messages via Twilio and did not implement a call back url for the status and replies. So the responses are getting dropped on the floor.

I was hoping to create a simple web service in WinDev 20 to get this done. From the documentation it seems like Twilio does a simple Post to whatever URL I give them and then I have to parse out the data. In version 1.0 of this, I am simply going to lookup a reference number and then email it (along with the reply) to a group email.

So I am curious as to where I would start with this. Do I create a web service project? Is there a way to specify that the web service will be .NET, XML, JSON, REST?

For now, I would simply like to set up a simple web service to take the data posted and email it to myself.

Any pointers would be appreciated...

Thank you!!

Confused in NJ...

Paul

http://blog.webscript.io/simple-twilio-applications.html

https://www.twilio.com/docs/api/twiml/sms/twilio_request
[attachment 1862 TwilioCallBackURLConfigurationforTwilioPhoneNumber.png]
Posté le 07 février 2016 - 12:31
Hi Paul

the easiest way to do that is to create one awp page in webdev. It will be in effect a REST type webservice. Use the pageparameter function in the page init code to get the value of the parameters sent by twilio (there is a different syntax to use depending if they arrive in post mode or get mode)

After that, the code of your page is whatever you want (sending emails is of course easy). There is an example of all that in wxReplication/WXEDM, as I'm using the same system for the communication part of the replication

Best regards
Posté le 08 février 2016 - 01:08
Thank you, Fabrice.

Fortunately, I have WebDev 19 and I have been working with it for the past couple of hours.

I install the WebDev Application Server on one of my servers, but for the life of me cannot get WebDev 19 to connect via FTP.

Paul
Posté le 25 mai 2016 - 20:44
Hi,

I also use TWILIO to send SMS and phone call. I have a problem with the StatusCallbackEvent. I have to send 4 parameters with the same name but with 4 differents values. The problem is that HTTPAjouteParamètre only keep the last one : "completed".

Any idea?

HTTPCréeFormulaire("frmEtape1")
HTTPAjouteParamètre("frmEtape1","From",CS_TWILIO_TELEPHONE_FROM)
HTTPAjouteParamètre("frmEtape1","To",lcNoTelTO)
HTTPAjouteParamètre("frmEtape1","Method","GET")
HTTPAjouteParamètre("frmEtape1","Url",cURLDocXML)
HTTPAjouteParamètre("frmEtape1","StatusCallback",CS_TWILIO_URL_STATUS_CALLBACK)
HTTPAjouteParamètre("frmEtape1","StatusCallbackMethod","POST")

HTTPAjouteParamètre("frmEtape1","StatusCallbackEvent","initiated")
HTTPAjouteParamètre("frmEtape1","StatusCallbackEvent","ringing")
HTTPAjouteParamètre("frmEtape1","StatusCallbackEvent","answered")
HTTPAjouteParamètre("frmEtape1","StatusCallbackEvent","completed")

SI HTTPEnvoieFormulaire("frmEtape1", CS_TWILIO_URL_CALL_XML,httpPost,"",cAuthorization,"application/x-www-form-urlencoded") ALORS
pcResultatReq=HTTPDonneRésultat(httpRésultat)
FIN
Posté le 11 mai 2017 - 22:55
Good day,

I am sending SMS via Twilio and for the life of me, i can't get the answers back from Twilio in Windev.

Any clues to share
Much appreciated
Normand