How to send sms to users from Django application?

+5 votes
I'm looking for an option to send otp to users's registered mobile number irrespective of country when they login.

I tried with twilio(trial version) but it sends msgs from 9am to 9pm and also messages will be send only to a number verified by  twilio.

As per my understanding twilio doesn't support this feature for all countries. Any help appreciated.
Nov 13, 2018 in Python by Manu
• 170 points
3,454 views
@Manu yes you are correct Twilio sends message only to twilio verified numbers.

You can use Google service api known as pygooglevoice
Thanks Priyaj. I will try this.

I used pygooglevoice but I was getting below error. 

voice.py", line 75, in login
  galx = re.search(r"type=\"hidden\"\s+name=\"GALX\"\s+value=\"(.+)\"", content).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

I tried few workarounds but it did not work. I implemented the functionality using Twilio Authy api.

Hey @Manu. I tried this and it worked:

import sys;
from googlevoice import Voice

voice = Voice()
voice.login()

phoneNumber = "+919886185535"
if (phoneNumber == ""):
    print("Hi there")
    sys.exit(-1)

text = sys.argv[1:]
if (text == ""):
    print("You must specify a message.")
    sys.exit(-1)

voice.send_sms(phoneNumber, text)

Source: https://gist.github.com/AndrewNeo/1081363

Hello Mr.Manu. I am facing the same problem with pygooglevoice. Could you please tell me how you implemented it using Twilio Authy api. Thank you.
@Manu the link that you sent has good content. How are you using it in your case?

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
1 answer

How do you configure Django to send mail through Postfix?

You can do this by adding  settings.py ...READ MORE

answered Feb 25, 2019 in Python by SDeb
• 13,250 points
1,426 views
0 votes
1 answer
0 votes
1 answer

How to send email via Django?

Hello @kartik, I use Gmail as my SMTP ...READ MORE

answered May 6 in Python by Niroj
• 32,440 points
73 views
0 votes
1 answer

How do I add a link from the Django admin page of one object to the admin page of a related object?

Hello @kartik, Set show_change_link to True (False by default) in your inline ...READ MORE

answered Jun 12 in Python by Niroj
• 32,440 points
47 views
0 votes
1 answer

How to execute a Python script from the Django shell?

Hello @kartik, The << part is wrong, use < instead: $ ./manage.py shell ...READ MORE

answered Jun 22 in Python by Niroj
• 32,440 points
33 views
0 votes
1 answer

How to get the SQL from a Django QuerySet?

Hello @kartik, Try this in your queryset: print my_queryset.query For ...READ MORE

answered Jun 23 in Python by Niroj
• 32,440 points
14 views
0 votes
1 answer

How to get all related Django model objects in Python?

This actually gives you the property names ...READ MORE

answered Nov 14, 2018 in Python by Nymeria
• 3,540 points

edited Dec 18, 2018 by Nymeria 2,323 views
0 votes
1 answer