General Bytes offers the Twilio API to send SMS codes to you & your customers. The charges per SMS vary across regions.
NOTE: The major phone carriers around the globe impose limits upon the frequency of SMS transmission. They do this to prevent SMS spam & to provide a consistent service. The carriers use equipment that has limitations; there’s no getting around this. When these limits are exceeded, the carrier will “filter” out the excess SMS traffic, and those messages will simply be discarded: lost. You’ll commonly see these filtering events occur in batches.
Navigate to Twilio at: https://www.twilio.com/
Create your Twilio account.
NOTE: The designed use case for SMS messaging within CAS is for Identity Verification and Opt-in Notifications (“2FA”). We encourage you to obey these strict limitations.
Crypto-related solicitations are forbidden, as is any other “high-risk” financial spam.
Twilio will reject you (or close your account) if you use their service for such messaging.
US/Canada guidelines: https://support.twilio.com/hc/en-us/articles/360045004974-Forbidden-Message-Categories-for-SMS-and-MMS-in-the-US-and-Canada
Provide a valid email & phone number, and the following options:
Locate your keys:
Both the “ACCOUNT SID” and “AUTH TOKEN” are required.
Buy a phone number.
In this example, the cost is only $1/month.
Make sure it is SMS & Voice capable (MMS, Fax not required).
Per Twilio: “Toll-free verification required for US messaging. US Toll-Free numbers will not be able to send messages until the verification has been approved.”
Assemble the required parameters:
Using a colon “:” between all 3 parameters, place them in this specific order:
SID:TOKEN:PHONE
For this example, it would look something like:
ACc1ef9a43c47020ee0c4a0a5980dc839b:8a1d4ae90d81306e0208eec086f:+18558101002
Copy & paste the entire parameter string in one paste operation.
CAS fields doesn’t append previous entries.
Navigate to CAS: Organization: SMS Provider
Enter the parameters from the previous step:
Save it.
Return to the setting, and test it.
You’ll be asked for a receiving phone number.
The number should be in international format, e.g.
+420296399328
For trial accounts (only), the number must be pre-verified in your Twilio settings.
If everything went as planned, you should see:
Troubleshooting
From the BASH console, you can test your Twilio settings to ensure that:
the settings that you are entering are correct, and
the Twilio service is working as expected, and
your Twilio account is working as expected.
First, collect this information and set these from your Twilio settings:
sid=[ENTER YOUR TWILIO SID] token=[ENTER YOUR TWILIO TOKEN] from_phone_number=[ENTER YOUR TWILIO "FROM" PHONE NUMBER] test_number=[ENTER THE INTERNATIONAL-FORMATTED TEST PHONE NUMBER]
If everything is correct and functional, then this (typed in the same, active bash window) will send a text to the target phone number:
curl "https://api.twilio.com/2010-04-01/Accounts/$sid/Messages.json" -X POST --data-urlencode "To=$test_number" --data-urlencode "From=$from_phone_number" --data-urlencode 'Body=Hello from GB' -u $sid:$token
This an example result:
The
test_number
should receive the SMS if everything is working, active, and you have the correct settings. Any issue on the Twilio side will cause this to fail, resulting in an “ERROR”.You should test this first when it doesn’t work in CAS. Twilio failures within CAS are extremely unlikely after they are properly setup. The more likely issue is a problem at Twilio.