Storing US numbers as +1 plus 10 digit number

Hi,

There’s probably a super simple way to do this but it’s escaping me.

The use case is Twilio SMS via Bubble. I have the API set-up and it’s working for the most part.

Twilio accepts a variety of formats whether +1 (area code) number or just (area code) number. My challenge is when SMSs come back from Twilio to Bubble, those numbers are formatted as +1 (area code) number. If the number in my DB doesn’t have that +1 attached to the phone number, Bubble won’t match only on the 10 digit number. Please correct me if I’m wrong.

My question is the best way to set up an input and workflow so that the phone data from my users is formatted as +1 (area code) number. International formatting will be important but isn’t as much now. What have you guys done to accomplish the +1 format for your phone numbers that are saved in your databases?

Much appreciated!

1 Like

Hello @chrismilleratx

Use Regex to remove +1 and other characters. regex: /d.
I always save phone number as 10 digits. If you need countries code, have a separate field imo.

1 Like

Thanks @JohnMark. I’ll give it a try and post the results.

1 Like

JohnMark,

I could use a little more of your help if possible.

I’ve not used regex before. Investigating it, it looks really powerful provided you understand the expressions. I’m trying! :slight_smile:

Can you help me solve this? I’m sending
0123456789 to Twilio and I’m getting back +10123456789 from Twilio. What would be the regex that I’d need to input in Bubble as my extraction so that I arrive at 0123456789 .

Thank you!

This topic was automatically closed after 70 days. New replies are no longer allowed.