Communication in Python
Twilio is a very commonly used service for messages and calls. Here, as of now, we will understand implementation with Twilio and SMTP (to send emails using Gmail)
What is Twilio?
Twilio is an API that software developers can use to add communications such as
Mobile messaging
Two-factor authentication into their Python applications
Check the validity of a mobile number
Whatsapp messaging
Phone calling
Video
Communications using Twilio, How to do it?
First, you need to create an account on Twilio. The procedure is clearly given in Twilio documentation. For more details check the implementation. The simple procedure includes:
Create an account
Open the console after logging in to the account
Note "Account SID" and "Auth Token", this is required for using Twilio with python
Going step by step through the 4 sample use cases should provide you the overall view of Twilio usage.
Free up to 200 messages per user are allowed using Twilio.
Twilio gives a 15.5 dollar sign in balance, which can be used to buy a Twilio number (which is required for sending SMS or for calls)
Hence, we get sufficient balance as a free user for practice and learning purposes on Twilio
The trial account can not send messages to unverified accounts, verify number before sending SMS
Communication using SMTP: Send Email
Implementation
1. Messaging for a daily update at a particular time every day (share price updates)
The message includes both mobile phone SMS and email. Functionalities creating in the app
Accumulate price, volume, and change of each share from the "money control" website
Send SMS using Twilio, and email using SMTP (email should be properly formatted in tabular form)
Send WhatsApp SMS as well using Twilio
Github repo to be updated....
2. Messaging for a Flask app error alerts
For sample code, go through the git repository: "to be updated" and branch "to be updated"
3. Two-factor authentication for the login
to be updated....
4. Check mobile number validity
to be updated....
Use Cases
Twilio provides a lot of functionalities, which we have not covered here; but are well documented along with good descriptive use cases and step by step implementation guide. Go through the different links listed in following link:
Last updated
Was this helpful?