Twilio Module - Watch Messages

Hello Community,
My Goal: I am trying to receive SMS messages from the Twilio, Watch Messages module. I’d like the module to trigger ‘on-demand’ as they come in.
I have searched the topics and found this response in another topic:

The ‘on-demand’ reference is confusing since the post seems to imply that you have to use api webhooks to handle messages as they come in… which seems to be conflicting with the meaning of ‘on-demand’. The documentation on the Twilio modules is limited, with no real examples and doesn’t appear to mirror the Twilio API documentation.

What I’ve tried: I’ve built a simple scenario with 2 Twilio modules. The trigger module is the Twilio Message Watcher, set to on-demand. In it, I am watching for an incoming response from the original sms sent to my test phone. The 2nd module is Message List module and really just a mechanism to test that I can talk to Twilio via their API.

Results: The watcher module never fires after test phone responds to the original SMS. When I manually trigger the watcher, I get no data. However, I know the API is authenticated because I can manually run the List Messages module and I get a list of messages that have been sent/received in Twilio.

Thanks for your responses!
Duane

Hello! Welcome to the Make community!

You are absolutely right! The Twilio App we have in Make only allows the Watch new messages in a scheduled scenario. Which means that we grab new messages only when the scenario runs.

It can be enough for some cases, or you could prefer to react immediately… In that case, the App provided doesn’t allow this unfortunately…

BUT, apparently, Twilio provides the capability to call a Webhook when a new message is received (Messaging Webhooks | Twilio)

In Make, you can create a Custom Webhook (that calls a scenario); it provides an URL you could configure in Twilio.
It means that the first step of your scenario will not be a Twilio Module, but a Custom Webhook.
Unfortunately I don’t have access to a twilio account, so I can’t test. But I recommend you to have a look at the link I gave you.
On the side of Make, I can help you build the Webhook Scenario if you need.

Kind regards

Benjamin

3 Likes

Hi @Duane_Owens,
For On Demand, you run it when you need it.
On-demand only runs when you click Run Once or run using API (including the “Make - Run a Scenario” module from another scenario).

Scheduled will periodically check for new SMS, but you still also have the ability to use Run Once or the API.

If you don’t have the need to immediately send a response to the sender, you can continue to use this method, just be sure it’s scheduled (instead of On Demand) so that it runs periodically. At some point you’ll need to use a separate Twilio module to send an SMS back to the sender.

If your goal is to respond to sender immediately, then you need to set up your scenario differently.

First, add a Webhook module to your scenario and generate a unique webhook address.
Next, log in to Twilio and enable webhook on incoming SMS following the instructions that @Benjamin_from_Make linked. Use the address that your webhook module just created.
Next, back in Make, add a Webhook response module. Whatever goes in this module will be texted back to the sender. If you don’t include this, they’ll simply receive an “Accepted” message since that’s the default response when a Make webhook is called.

Now, when someone texts your Twilio number, the webhook will be called and a bunch of info about the message is passed in the webhook payload, including the sender’s phone number, message, and some other stuff.
Use the Webhook Response module to text back the person, you don’t even need a separate Twilio module for sending back an SMS.

3 Likes