Twilio SMS and Whatsapp

Hi,

does anyone know of any decent tutorial videos on setting up 2 way SMS and whatsapp via twilio?

thanks

1 Like

Hi, @tom23! Are you looking for a send & receive chat UI on the Bubble side that sends SMS to your users’ (or their customers’) phones?

hi. yes

I implemented it with the rest API. I haven’t found any tutorial, just went with Twilio documentation. It can be overwelming, so go slowly. This is not a tutorial, but here is a basic overview of what you should do :
If you’re gonna make 2(or more)-way conversations, between different people, use the Conversations product. Normally you’re gonna do something like this:

  • Setup (make once for all conveersations) :
    • Get a Twilio number
    • Make an Whatsapp template to start the conversation (all whatsapp numbers can only receive template messages if they havent answered in the last 24h)
    • Set a Messaging Service Object with the Twilio number(s) (I think this is optional, but is nice to have it organized)
    • Set a Conversation Service Object
  • For each conversation:
    • Create a conversation object
    • Create the conversation Participant for each of the actual participants, setting the pair (Twilio number - participant number)

And then you can just create messages through the conversation. Of course, if one of the participants in a SMS or Wpp number, they can also send a message.

It is important to notice that you can only have ONE pair (Twilio number - real number) per conversation. So if you want to have your private number connected to various conversations, you will need different twilio numbers (basically, from you’re personal number’s point of view you’re talking with the twilio number)

Nice summary, @vicente1! What does your onboarding process look like for registering your users with their own Twilio number (I assume this is what you’re doing)?

Hi.
I’m not sure I quite undestood you here. The Twilio Number is not strongly linked to the User/Client. You can use one twilio number with any number of users at any point.

We, for exemple, just use one twilio number for now. Our main usage is just to send notifications, so we don’t need different twilio numbers. We do have the structure to make conversations, but for now, as it’s not a priority, we just use the same twilio number.

Just to set straight, you do not need different Twilio Number for each person fo one conversation. Each twilio can send messages to basically an unlimited number of client numbers (there is a message frequency limit, I think, but is high). You will only need multiple Twilio numbers if you want it to show as different numbers/conversation in the Client phone. This will naturally be the case if each client can have multiple conversations with different clients. In this case, I would say to get a quantity of Twilio Numbers in a way you have a limit of how many conversations a Client can have at the time.

2 Likes

Thanks @vicente1. I’m doing something similar where all my user’s messages are being sent to their clients through one phone number. I assumed your users each got their own number but I guess this is not the case- you’re only sending one way messages at present.

Yes. For now we manly use for notifications. I built the infrastructure for the conversations, but considering always one Twilio Number (for now).
I haven’t seen anything in the documentation about sistematically creating Twilio Numbers when you need, but maybe you should ask they’re support, as it is an expected user-case.
I would recommend you using a pool of twilio numbers that you manage, so you can re-use them.

1 Like

Gotcha- that’s interesting. For 2-way messaging, users would respond to a single number but it would be routed to the conversation that specific user has access to privacy wise. I’ll have to try it out. I’m looking to do a text chat type thing similar to a Drift-style UI.

Well, the number people see in their phone and respond to is the Twilio Number. So, if there is just one, you just need this number. The problem is in case one user is in different conversations at the same time, as twilio only allows the pair (user nulber - twilio number) to be in one conversation at each time. And really, how would you route the messages to the right conversation if there were different conversations ?
I don’t know exacly your user case, but if you need more help feel free to ask

@vicente1 Thanks for this rundown, proving useful. I’m busy trying to set up a conversation (this works fine) but I keep getting errors when trying to add both an SMS participant and a chat participant, despite following the docs precisely:
{“code”: 50204, “message”: “Identity not provided”, “more_info”: “Programmable Chat: Identity not provided | Twilio”, “status”: 400}

=

Are you able to share the details of the call you’re making for each in the api connector to get this working? Thanks in advance

Did you ever figure this out?