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

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.

Related

Trying to get inbound text responses in GoHighLevel

I have Twilio integrated with GoHighlevel. I am trying to get inbound SMS responses to appear in the GHL contact. Outbound messages are functioning and logging correctly, but not inbound. Can anyone assist?
Twilio developer evangelist here.
I've not used GoHighLevel, so this is a bit of a stab in the dark.
Incoming messages to a Twilio number trigger a webhook (an HTTP request) to an application to notify the application. If the webhooks aren't set up correctly, then those messages won't make it to the other application (though they are all stored within Twilio).
I would recommend you log in to your Twilio account and check the settings for your numbers. You want to ensure that your numbers have a GoHighLevel URL setup for incoming messages.
In one of the GoHighLevel support topic videos for Twilio I spotted what the webhook URL should probably look like.
https://api.gohighlevel.com/twilio/incoming_message
Check your numbers, make sure they have something like that. And if it is still not working then I would contact GoHighLevel support to find out what the correct settings should be.

Twilio SMS and Survey

I am using Twilio to communicate with my users via SMS. I have my own web application that reads the incoming Twilio message. I use a web hook for that purpose. I am able to read the incoming message and process it in my web application.
I would like to send out survey questions periodically during the day to the same number. I researched the Studio flow for this purpose. It looks like a good option to write a survey.
I have a doubt though. In twilio console I added my url as a web hook to receive all sms messages. If I build a studio flow then how do I use that. I already have a web hook but I also want to do a survey using the same twilio phone number. Is there a way to do this in Twilio.
What I want to achieve is I receive SMS from a twilio number all through the day using a web hook. Every 2 hours or so I would like to send out a survey question to the same twilio number and process the answer in my end. What is the best approach to do this? I use c# and .net core to write my web app.
Thank you
you can do this.
You would use the REST API path of the Studio Trigger widget of your Studio Flow, to kick off this outbound SMS. You can find more details below. The scheduling logic, every 2 hours, would be handled by your application logic.
Trigger a Twilio Studio Flow Execution via the REST API
Execution
We use the REST API trigger for the Appointment Reminder Studio example.

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.

How to make your bot user reply with a simple help message using slack bot

I have created a slack bot and I want to send a general static help message to users when they send a direct message to my bot:
Should I subscribe to Events API? Or do I need to do this in another way? I couldn't find a clear answer for this.
There are two ways to do make your bot user reply to direct messages:
Events API
Real Time Messaging API
In my opinion the Events API approach is easier to implement since it does not require using WebSockets.
The basic approach with the Events API is:
You need an endpoint that can receive event requests from Slack and
react to it, e.g. by sending a direct message back to a user.
Subscribe to message.im event for your bot user
Note that a bot user already has all the required scopes for this with the bot scope.
In addition I would recommend to subscribe to app.mention for your bot user. Then it can also react to mentions in other channels.
Btw. that message you posted looks a lot like a review comment from the Slack team for a new app submission. I got a similar one for my last app and I solved it with the approach above. In general it looks like if you want to have a bot user in your app it needs to be able to respond to help request from users.

undefined:undefined Twilio Studio Flow SMS Forwarding Function Error

I've been attempting to create a two-way conversation using SMS forwarding in Twilio Studio flow. I know there are multiple ways to set up SMS forwarding in Twilio, and I have been successful in doing so using functions on their own, TwiML and Studio Flow SMS on the send message widget. However, I am struggling with creating a flow that extends beyond one message. I've added the function for SMS forwarding into my flow, but every time a response is received it displays as "undefined:undefined" as opposed to "+15555555555:Hello SMS", Am i missing something?
You might want to use the CHAT product from Twilio instead which would manage all of the sessions, conversations and everything else.

Resources