Yeahprettymuch
Yeahprettymuch

Reputation: 541

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!

Upvotes: 0

Views: 61

Answers (1)

Alan
Alan

Reputation: 10781

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

Upvotes: 1

Related Questions