Mark Carpenter
Mark Carpenter

Reputation: 21

Twilio messaging service and studio flow

I am working on a project in Twilio and Podio, where I am using this code from Podio using POST

POST IN PODIO

FROM URL:  https://[(Ref Setting) Setting Value 1]:[(Ref Setting) Setting Value 2]@api.twilio.com/2010-04-01/Accounts/[(Ref Setting) Setting Value 1]/Messages.json

POST PARMS: To=[(Ref Lead) Mobile Phone]&MessagingServiceSid=[(Ref Setting) Setting Value 3]&Body=[(Variable) strMessages]

---This works fine, and I can send my message no problem, I am using a MessagingServiceSid because my volume has increased I have about 4 numbers in the messaging service.

The problem I am encountering is I had a Twilio Studio Flow set up to handle the incoming text messages when I was just sending from the sid, and I am wanting to figure how if I can make sure that when someone responds to my messages they get sent to the studio flow set up to handle the responses. I am also wanting to get the responses back into Podio.

I have tried changing the Numbers settings in messages settings to that particular studio flow, but when I do that, it takes the number out of the Messaging service that I am using to send the messages.

Upvotes: 2

Views: 1124

Answers (2)

storm143
storm143

Reputation: 94

I tried to follow Abhijeets answer, but unfortunately due to the way messaging services and Twilio phone numbers differ, it's not possible to have the SMS replies work correctly.

I tried to do something similar to you. I was triggering the Flow execution by POSTing to the REST API url trigger, and I used the "Send & wait for reply" widget to send and receive a reply from a number. It worked perfectly when only sending from one phone number, but when I switched the "Send & wait for reply" widget to use a messaging service to send it instead, the responses always triggered the "Incoming Message" start of the Twilio Flow. So it made an entirely new execution, and my previous execution never was completed.

After reading a lot of documentation I could never get around this, so what I did was instead just purchase and assign additional phone numbers to the Twilio flow. In my application, I triggered the Flow execution using these phone numbers (randomly), and then the "Send & wait for reply" widget used this phone number to send out the text message. That ended up working for me, since I was only using messaging services to send out SMS messages with multiple different phone numbers.

Upvotes: 2

Abhijeet
Abhijeet

Reputation: 23

You need to assign numbers and studio flow to a messaging service.
To assign a number to messaging service:
While configuring a phone number you need to go to its "messaging" section and configure with the messaging service.
To connect messaging service and studio:
1) Goto studio flow -> click on the trigger -> copy the webhook URL
2) Goto messaging service -> inbound setting -> paste the URL in request URL

To get the response back to your servers(I am not familiar with Podio), add an HTTP request block in your studio flow. In that add a request URL pointing towards your server and in the request body you can add the body of text which looks something like FROM:{{trigger.message.From}} BODY:{{trigger.message.Body}}

Upvotes: 1

Related Questions