Triggering a Twilio function to write a record in an external service (e.g. a CRM) whenever an sms message is SENT via Twilio - 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

Related

Send customized bulk SMS with twilio

I want to send different messages to multiple users at once. I read the article here: https://www.twilio.com/blog/send-bulk-sms-twilio-node-js-html but it mentions nothing about sending customized messages. The only difference in my messages is the user's name.
The best solution I can think of is to create x number of API calls to send messages to x numbers. I believe that's going to be time taking. Is it possible to do it with one API call?
Twilio developer evangelist, and author of that post, here.
You are right, there is not currently a Twilio service that allows you to send bulk messages with customised messages with one single API call. You will have to make an API call to the messages resource for each message you want to send.
When sending messages in bulk, I recommend you read and understand this article on Twilio rate limits and message queues. That will ensure you are successful in sending your messages.

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 filter messages by their content?

I am trying to use the Twilio API and I would like to use the message content as a filter. So ideallay I would like to make a request like https://api.twilio.com/2010-04-01/Accounts/AccSID/Messages.json?body="test" and it would include all the messages that have the word "test" in their body whether inbound or outbound messages.
In Twilio docs I could only find filtering messages by date sent. Can the above use case be achieved with Twilio?
There isn't a parameter to filter message body content using the /Messages resource. You can look at the BulkExport API to export the messages to your datastore or capture the logs locally from your Application server upon origination and termination of the message responses and store those in your datastore for later filtering based on your DB logic.
BulkExport API Overview
Best Practices for SMS Message Logging

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

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).

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