papercups-io / papercups

Open-source live customer chat
https://app.papercups.io/demo
MIT License
5.73k stars 509 forks source link

Better phone number filtering for twillio and SMS in integrations page #816

Open cheeseblubber opened 3 years ago

cheeseblubber commented 3 years ago

Problem Right now if you enter a phone number without the area code or have the wrong formatting in phone number section it will fail silently and not work. We should make sure that there is a country code and that it can work regardless of the text formatting

Screen Shot 2021-05-05 at 5 30 52 PM

Solution It should validate that it has a country code and we shouldn't care about formatting

cheeseblubber commented 3 years ago

@a8t you might have some context on this

a8t commented 3 years ago

Twilio has a free phone number validator service that we already use for something else. Maybe we can also pair with a client-side validation. (is a phone number regex stupid?)

link dump https://www.twilio.com/blog/international-phone-number-input-html-javascript

https://www.twilio.com/docs/lookup/tutorials/validation-and-formatting#format-an-international-phone-number

https://www.twilio.com/docs/lookup/tutorials/validation-and-formatting#validate-a-national-phone-number

cheeseblubber commented 3 years ago

Yeah I think just some client side validation + string formatting would be ideal. It doesn't work if we add spaces in to the phone number