- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Send SMS updates to mobile phone using python
In this tutorial, we are going to learn how to send SMS in Python. We will be using Twilio for sending SMS.
First of all, go the Twilio and create an account. You will get free trial account. And finish settings.
We have to install a module called twilio to work with Twilio client. Install it with the following command.
pip install twilio
Now, go to the Twilio Documentation on how to send SMS using Twilio client. Or follow the steps to send the SMS.
- Import the twilio Client from twilio.rest.
- Get and store the account_sid and auth_token from the your Twilio account.
- Make instance of the Client by passing account_sid and auth_token.
- Now, get the from number from your Twilio account.
- Now, send the message using client.messages.create(body=message, from_=from_number, to=verified_number).
- You will get the message.
Example
# importing the client from the twilio from twilio.rest import Client # Your Account Sid and Auth Token from twilio account account_sid = [ACCOUNT_SID] auth_token = [AUTH_TOKEN] # instantiating the Client client = Client(account_sid, auth_token) # sending message message = client.messages.create(body='Hi there! How are you?', from_=[FROM_NUM , to=[VERIFIED_NUMBER]) # printing the sid after success print(message.sid)
If the message is sent successfully, then you will get the hash code as follows without any
SMd954e170ca2545248075c3bc2623aabd
Conclusion
If you have any doubts in the tutorial, mention them in the comment section.
- Related Articles
- How to send a SMS using SMSmanager in Dual SIM mobile in Android?
- How to send a SMS using SMSmanager in Dual SIM mobile in Android using Kotlin?
- Send SMS using a GSM module connected to Arduino
- Advanced Mobile Phone System
- Mobile Updates of the Week 37
- Mobile Updates of the Week 40
- Digital Advanced Mobile Phone System
- How to get information about mobile supports sms or not in android?
- Can a Mobile Phone Battery Track You?
- Why should the use of mobile phone be avoided?
- Why people are used by the mobile phone rather than using it for their own benefits?
- Send mail from your Gmail account using Python
- Multiple atomic updates using MongoDB?
- Program to find all possible strings typed using phone keypad in python
- How to send email using PowerShell?

Advertisements