Starting an outbound SMS conversation via Twilio
# 🤝help
f
I'd like to trigger a bot via webhook/Zapier, and have it initiate an SMS conversation via Twilio. Example: 1. User fills out a form to be contacted 2. Form calls Botpress (or Zapier to then call Botpress) 3. Botpress reaches out to the user to initiate the conversation (first message is outbound, not inbound) I was able to achieve this by sending the first message outside of Botpress, then catching their reply. This makes it seem like one experience for the user, while I'm managing two workflows on my end. This works OK. Issues with this approach: 1. When the user replies Botpress is slower to wake up, since Botpress didn't start the conversation 2. I have to use external workflows to stitch the initial message + the Botpresss conversation 3. I'm having a hard time getting the phone number from Botpress to then stitch the conversation (asked for help w/ that here: https://discord.com/channels/1108396290624213082/1148668060669063291)
f
This is the approach I had in mind 🙂
1. Sorry there is no workaround from that
usually this happens only with the first message, so for example the first message from the first user will experience the slow response
but the first message from the second user will not be slow
2. Can you give me more context, what are you trying to achieve and why do you need that stitch?
3. If you are a developer you can pull the code, enhance it then do PR that will be reviewed by our team
I can guide you there if you want
f
Thanks for the reply @famous-jewelry-85388 ! 1. Ahh, ok. Hoping someone (internal or otherwise) builds this feature! 2. I can't tie together an off-Botpress form submission to a Botpress conversation with 100% certainty. Since Botpress doesn't share the Twilio request body with the workflow, I can't reference its contents (phone number, mainly) downstream. Having access to the phone number would be crucial to associate a Botpress conversation with anything that happened beforehand (a form submission, in my case). 3. I don't write code. Not at that level, at least. Can you think of ways to tie a Botpress conversation with a form submission? The form only takes the contact's phone number. I can think of two ways that require significant effort: Twilio logs to stitch them. So, consume the feed of SMSs being sent/received, and pair them with a form submission. This requires a lot of building, though, for something that Botpress would solve by simply ingesting the Twilio request body (even if just the body from the first message in a conversation). The other one would be to have a layer between Twilio and Botpress. Create a workflow in something like n8n that receives the Twilio call, saves the payload, then calls Botpress, then Botpress replies to n8n, then n8n relays the message to Twilio. Feels like a heavy lift.
f
Hey Alex, Did you try looking in the event.tags?
it should be under
event.tags.user
and
event.tags.conversation
so, in the first node of the flow
add a new "execute code" card
in the code add
console.log(JSON.stringify(event.tags))
test the bot from the proper channel
go back to your bot dashboard, open logs and you should see whats there in the event.tags
if you don't understand the output, you can share it with me and I will help you form there
f
Ohh, thanks! I'll go back to and check that out. Had moved on from this specific use-case thinking it wasn't possible.
f
@famous-monitor-36380 how is it going 🙂 did it work for you?
f
What's up, @blue-glass-78004 ! Haven't had the time to test it out. Implemented a different workflow for a solution I was working on. Will come back to this when I have some time to test it out. Thanks again!
b
I think you tagged the wrong person.
f
@blue-glass-78004 yea I think so 😄
@famous-monitor-36380 Sure 🙂
h
Hi guys, I'm trying to achieve kinda the same thing. Trigger from FB lead forms, then make botpress send sms to the number the user submitted. @famous-monitor-36380 I would love to hear if you went over this!
I was thinking on using Zapier or Make.com as they have a trigger that fires when a new lead is created on FB ads, and it maps the lead info so after that I'm trying to find a way to make Botpress send an SMS to the number (gotten from the lead form) with Twilio. But I'm not 100% sure how I can proceed. Any advice @famous-jewelry-85388 ? Would really appreciate it!
f
Hey @hallowed-waiter-46283 , Let me list here what I am thinking about:
If you have development background:
1- So Facebook, can send the information directly to Botpress webhoook: https://developers.facebook.com/docs/graph-api/webhooks/getting-started/webhooks-for-leadgen/
2- In Botpress, you can write a sample code that uses Twilio APIs to send SMS to the user
3- When the user replies back to Twilio, Twilio will forward it to Botpress then the conversation will continue from therre
That should be cheaper
If you don't have development background:
2- But from Zapier, send the SMS directly to the users
3- When the users reply back to the SMS, Twilio will automatically forward it to Botpress
I hope that was clear 🙂
h
Hi Bassam, I hope you're doing well. Thank you for the response!! I don't have a development background, so I did the zapier method you're suggesting. I did steps 1 (although I'm not sure I understand why you did: FB ads trigger → POST instead of FB ads trigger → Send Twilio message) and 2 all good there. But I'm not sure how I can make Twilio automatically forward the sms to botpress when the user replied to it.
f
If Twilio is configured like this https://botpress.com/docs/cloud/channels/twilio/
it should work automatic
did you try it?
h
Oh so that was for that! ......... THanks a lot!!!!!!!!!!
@famous-jewelry-85388 really appreciate all the help!!!
f
You're welcome!!
Happy bot building!
h
Hi Bassam, long time loll. I actually tested this from my USA twilio number to my USA skype number and as you saw it worked perfectly. But now I'm trying it directly to my personal phone number (from Peru) and it doesnt work. It only sends the initial twilio message but after that I reply and the bot doesnt respond. Any idea why this might happen?
f
are there any logs in your dashboard?
h
nope, nothing appears when I try it
and the weird thing is that when I configure it to send to my USA skype phone number there IS logs and it does work
this is what appears when it works (with my USA skype number):
and when it doesnt (with my personal number from Peru) nothing appears lol
f
Is it added in your testing numbers
h
in twilio? yes, both my PERU and USA number
f
oh wait, sorry I missed that, you are using Twilio?
h
yep
remember when you helped me with this, it worked perfectly to my USA phone number but now I tried it with my Peru phone number and it doesnt work
Hi Bassam, I know you're probably busy but Ive been struggling for this for a while lol would really appreciate it someone from the team can help
f
Hey @hallowed-waiter-46283 Sorry I was very sick, I am a little bit better today and I can help 🙂
Are you still facing that challenge?
h
hi lol I took like a break from the AI stuff and 've been getting back to botpress recently 😭 I tried giving it another go but it still doesnt work
85 Views