freeflowuniverse / crystallib

Apache License 2.0
8 stars 4 forks source link

Twilio sms client #227

Closed xmonader closed 11 months ago

xmonader commented 1 year ago

part of https://github.com/threefoldtech/home/issues/1461

based on twilio https://www.twilio.com/docs/sms/quickstart/python

e.g in python

# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_AUTH_TOKEN']
client = Client(account_sid, auth_token)

message = client.messages \
                .create(
                     body="Join Earth's mightiest heroes. Like Kevin Bacon.",
                     from_='+15017122661',
                     to='+15558675310'
                 )

print(message.sid)
Omarabdul3ziz commented 1 year ago

update: I tried with a free trial account and it works fine but for the same number the account registered with. we need a paid account that can send to any number. opened ops issue mentioned above

Omarabdul3ziz commented 1 year ago

update: facing some issues sending to phone numbers located in Dubai. still investigating around this track ops issue https://github.com/threefoldtech/tf_operations/issues/1888#issuecomment-1698884685

Omarabdul3ziz commented 1 year ago

It seems there's an issue with sending Twilio SMS to numbers located in the Emirates. not sure if it's a blockage across the entire Emirates or specific to the phone number's carrier.

In my search for alternative solutions similar to Twilio, here's a summary of what I've found:

  1. SendGrid SMS: It also relies on Twilio, so it will face the same blockage issue.
  2. WATI: is limited to WhatsApp messages only.
  3. Message Bird: It looks like a good option, but I couldn't test it as there's no free trial available.
  4. Plivo: My account kept getting blocked when I tried to verify with my phone number. so i guess it is blocked in Egypt
  5. Telnyx: same as Plivo
  6. Sinch Message Media: Unfortunately, they don't allow registration from Egypt or even Belgium.
  7. Vonage (formerly Nexmo): This one offers a great experience and a dashboard/API similar to Twilio. However, it requires a costly 200 EU upgrade
  8. AWS SNS: It's a bit complex and couldn't find any example for API calls and couldn't test either, but it has specific pricing for messages in the Emirates so looks like it will not be blocked there.
  9. Infobip: This option is acceptable. but not certain of the blockage.

I suggest we use Infobip or Message Bird