Hi Marty,
The Architect variable Message.Message.senderAddress will give you the number of the phone. In a lot of the world this is relatively straightforward such as me in the UK would be checking the first 3 characters = "+44" or go to "+447" as we have a specific mobile prefix. As the USA is part of the North American Numbering Plan "+1" is too broad. I'd suggest a data table with all the US area code prefixes to check against.
You could also try the Message.Message.senderAddressInfo but in the UK I'm just getting the same as the sender address. A quick test is to create an Architect flow where you store the variables in Set participant Data and then check they show as expected.
So a Data Table lookup with the input as substring(Message.Message.senderAddress,0,5) and the Data Table records with entries such as +1907 for Alaska or +1808 for Hawaii could work for standard numbers. If a match is found continue otherwise disconnect or reply with a message then disconnect. I'd also suggest a flow outcome so you can quickly track and resolve any issues.
I think there was a very old Community Q&A about location based routing which is essentially the same logic.
Anyone with more knowledge of US numbering please join in. I've not added short codes as I would not expect those to be used for this type of traffic.
------------------------------
Richard Chandler
Connect
------------------------------
Original Message:
Sent: 04-30-2024 23:07
From: Marty Hand
Subject: Restrict SMS from non-US phone numbers
Hello everyone. We are a national crisis hotline for the United States. We have started to receive text message interactions from non-US phone numbers. I'm wondering if anyone has a suggestion for how to detect the contact is coming from a non-US phone number and send prevent it from completing the incoming flow?
Thanks
#ArchitectureandDesign
#DigitalChannels
#Unsure/Other
------------------------------
Marty Hand
National Domestic Violence Hotline
------------------------------