Skip to content

msdl2022/PythonSMS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Python SMS Sender using Twilio

This Python script demonstrates how to send an SMS message to a recipient using the Twilio API. Twilio is a cloud communications platform that provides an API to send text messages.

Prerequisites

Before using this code, you need to:

  1. Sign up for a Twilio account at Twilio.

  2. Obtain your Twilio Account SID and Auth Token.

  3. Create a Twilio phone number.

  4. Install the required Python library using pip:

    pip install twilio

Usage

  1. Replace the following placeholders in the Python script with your own information:

    • 'your_account_sid': Your Twilio Account SID.
    • 'your_auth_token': Your Twilio Auth Token.
    • '+your_twilio_phone_number': Your Twilio phone number.
    • to_phone_number: The recipient's phone number.
    • message: The message you want to send.
  2. Run the Python script. It will send an SMS message to the specified recipient.

Code Explanation

  • The script imports the twilio library to interact with the Twilio API.

  • It creates a Twilio client using your Account SID and Auth Token.

  • You provide the recipient's phone number and the message you want to send.

  • The script then sends the SMS message using the client.messages.create method.

  • The SID of the sent message will be printed to the console.

License

This project is licensed under the MIT License - see the LICENSE file for details.


About

A Python script to send SMS using Twilio library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages