Twilio Integration
# 🤝help
s
Hey there, I am working on an outbound SMS chatbot. First, there's a trigger in a Google Sheet with the client's name + phone number, which triggers an automation in Make. This automation sends out an HTTP post to Botpress (Trigger 1). Next, the "execute code" card assigns values to variables in Botpress, so the chatbot knows to whom it is speaking. Then, a webhook is sent to Make, which in turn sends an SMS message to the given phone number through Twilio. However, when the user responds, the conversation starts from the "start" state (marked in red in the picture), causing the chatbot to lose the information about whom it is talking to. This information is important for addressing the user directly by name later in the conversation. Is there a way for the chatbot to wait for the user's response in SMS without losing the variables? Is there any other way (perhaps better) to solve this problem? Any help is much appreciated. https://cdn.discordapp.com/attachments/1226976689762861206/1226976689947541514/image.png?ex=6626ba17&is=66144517&hm=e1baa79dad142dd8146e3d3e0552052797ea427a6d0481885043ea2bd4c96568&
r
@straight-apartment-84705 hey, how is the SMS response being sent to Botpress? My understanding from your message is that Twilio is called from Make, not Botpress?
Either way, the solution is to make sure that the non-conversational triggers (in your case, Webhook), has the same Conversation ID than the conversation the customer has with the chatbot. You can set/override the
Conversation ID
on the trigger directly. Make sure the Conversation ID exists, and starts with
conv_....
You can get the
Conversation ID
with
event.conversationId
when you're coming from a conversational trigger (such as Start Node or Webchat Conversation Started Node). You can pass the
Conversation ID
to make, which will give it back to Botpress in the Webhook event. You can then make reference to the conversationId from the webhook using an expression like
{{event.payload.body.conversationId}}
https://cdn.discordapp.com/attachments/1226976689762861206/1227283743534747719/image.png?ex=6627d80e&is=6615630e&hm=c499f1f64e3cab8d59a1b0dc13e8f63586c2b947ae3e7bae3f26a88001e4cb4a&
Another solution, which is probably better, is to not use Make at all and use the Botpress Twilio integration instead. You can also use the Google Sheet botpress integration as a trigger for when a row is added/changed.
s
Thank you, I‘ll try to implement this and see if it works. If I only use Botpress is it still possible to contact the phone number and send out an automatic message first? Because I tried to do that with an execute code card an the Twilio send sms api call, which didn‘t work
r
Yeah this should work, as long as you follow the whatsapp guideliness https://botpress.com/docs/cloud/channels/whatsapp/
s
Hey @rich-battery-69172 , I am currently working on this again, but I struggle to get it working. Just to clarify, the webhook event happens before the user starts the conversation. Once the user answers, the answer should go to "LeadResponse" and then continue the flow. So could you please explain your solution again / with more details? I struggle to understand it.
@fresh-fireman-491 I saw that you've been involved in the "keep state of conversation" and I think it's a similar problem I am facing here as well, so do you know how to fix this?
f
This haven't been released yet 🙂
s
Makes sense now, I couldn't find it 😅
f
I was only involved at the start, and I haven't used the solution provided. I would recommend you to read the post, and then try from there. You can always ask questions in that post about that topic.
s
👍
2 Views