How do I receive a Twilio SMS into a Logic App? - twilio

How do I create a Logic App to receive an SMS?
I made some progress in my question here
I have been studying the information I found here
and have configured the Twilio Webhook to Call the Http endpoint when a message comes in.
following instructions similar to this
I copied the Request Body JSON from the instructions.
If I the Add A Twilo -Get Message Action it asks for the Unique SID of the message. I can't know this at Logic App Design Time, so how do I get it?

Instead letting Logic App to "retrieve" the message from Twilio, as mentioned in the comments, you should set up a webhook in Twilio's settings page to invoke Logic App ('s request trigger).

Related

Twilio: track user action on SMS links and reply based on that action

I using twilio flow to create simple chatbot that sends user a whatsapp message with link to provide some details and once user has provided the required details on web page, chat bot must reply with a THANKS message.
Is there anything like postback using rest api on active execution based on which a thank you message can sent.
Please have look on diagram as well.
Twilio developer evangelist here.
When you say you are using Twilio flow, I guess you are using Twilio Studio to send the messages. In this case, I don't think you can achieve what you want with Studio. You can't move an execution on with the REST API.
However, it should be fairly straightforward to send the thank you message from your application using the Twilio Messaging API instead.
What you will need to do is, when the user submits the form, in your back-end code as well as saving the data to your database, make a call to the Twilio API to send the WhatsApp message. I'm not sure what your application is built in, so I've just linked to the relevant documentation.

Triggering a Twilio function to write a record in an external service (e.g. a CRM) whenever an sms message is SENT via Twilio

What the title describes can already be done easily via programs like Zapier, so I am hopeful that it can be done through Twilio functions directly.
Essentially, I have my CRM set up so that based on certain triggers, it sends a http POST request to the Twilio URL that controls SMS sending:
https://api.twilio.com/2010-04-01/Accounts/ + twilioAccSId + /Messages.json
For the most part, this works great!
I just want a way for Twilio to then respond by using a function to write a record into the CRM (using the CRM's APIs).
I would want the record written to include things like the delivery status of the message e.g. whether it failed, or was successful). I'm also open to exploring other ways where Twilio can transmit this outbound message info to the CRM through other means, and then having a function on the CRM then write a record!
Do you have the code to share of what you are attempting and the issue encountered? Or is the question more if this is possible? It is certainly possible.
You will use a statusCallback URL of your outbound POST to the messages resource, which will fire with the statusCallback messages and make an API call to your CRM to update the customer record accordingly. You can append a URL query parameter to your statusCallback, so you know which customer record to update.
Track Delivery Status of Messages
How to Share Information Between Your Applications
Passing Custom Information via Requests to Twilio

Twilio not sending webhooks in Progammable Chat

I would like to ask a question or maybe report a bug after solving my doubts. I started working with Programmable Chat and Twilio do not want to send a webhook to specific url but only when I'm sending message from my PHP code. I downloaded example node app and sending message from that, everything is working really nice, I'm getting post request from Twilio but if only I will send message from PHP, nothing at all. And strange is, after sending message from PHP, it will appear immediately in chat which means that it's working.
How does it possible? Could it mean that Twilio on theirs backend has an a bug when they receive message from PHP and becuase of that they are not fire webhook event?
I eliminated all differences, everything is that same beside that one message is sending from PHP and another from node. Same situation from API Explorer.
Gif presentation
Twilio developer evangelist here.
When you send messages to Programmable Chat from the REST API then webhooks aren't triggered. I think the reasoning is because you are making the call from your server, then your server is already aware that you are sending a message and you don't need to receive a webhook to do so. It also saves from the potential of infinite loops (if your webhook sends a message via the REST API, the requests would just go in circles).
So, it's not a bug, but a design choice. If you need to trigger your webhooks when you send a message from the REST API, you will need to make the webhook from your own server.

Twilio webhook backup solutions

I want to implement a Twilio webhook to receive sms responses for my initial sms message. However, instead of implementing the secondary "failover" webhook URL, is there a way to call a Twilio REST service to find out which webhook callback from Twilio to my service failed so my application can retrieve the failed message from the failed webhook call?
Thanks.
Twilio developer evangelist here.
I definitely recommend implementing a fallback webhook so that you can at least record failures and know whether to call this other service.
However, you can call the Twilio Monitor API to find out about Alerts. This is a service that will give you information on all webhooks and REST API calls that your application has made that failed or produced a warning of some sort.
Let me know if that helps at all.

Override Message Service inbound URL programatically

I have setup a trial Twilio account and have been investigating their
Programmable SMS service. Within my account I have also setup a Messaging Service. When I send an SMS I am able to set the URL I wish Twilio to send all delivery events (e.g accepted, sent, delivered etc) to, using a field called statusCallback. However, I am wondering if it is also possible to set the URL for which I wish to receive any replies to the message being sent, as part of the send SMS call? I know I can change the incoming request URL within the Messaging Services area of my Twilio account dashboard, but I would like to be able to set this URL on a per SMS basis, as part of the send SMS API call.
Does anyone know if this is possible? I cannot see anything in the docs to suggest it is but I wanted to know definitively.
I hope the question makes sense but if any clarification is needed then please let me know.
Thanks,
Paul

Resources