GithubHelp home page GithubHelp logo

isabella232 / sms-python-tutorial Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sinch/sms-python-tutorial

0.0 0.0 0.0 53 KB

Sending SMS with Python - Tutorial

Home Page: https://www.sinch.com/tutorials/sending-sms-python/

sms-python-tutorial's Introduction

Sending SMS With Python

In this tutorial, you will use the Python module SinchSMS to send an SMS message with Sinch. With the Sinch SMS API, you can build anything from a simple notification service to two-factor authentication solutions.

Video

We have also turned this tutorial into a quick video walkthrough. Click on the image below to watch the tutorial.

Send SMS in Python

For SMS pricing by destination, visit our pricing pages.

Setup

  1. Create a Sinch developer account
  2. In your developer dashboard, click “Apps” in the left-hand menu
  3. Click “Create new app”
  4. Name your app and click “Create”
  5. Take note of your app key and secret, you will need them in a few minutes
  6. Install the module using pip install sinchsms

Sending an SMS via the API

Launch the interactive console by typing python in your command line and type the below:

import time
from sinchsms import SinchSMS

number = '+yourmobilenumber'
message = 'I love SMS!'

client = SinchSMS(your_app_key, your_app_secret)

print("Sending '%s' to %s" % (message, number))
response = client.send_message(number, message)
message_id = response['messageId']

response = client.check_status(message_id)
while response['status'] != 'Successful':
    print(response['status'])
    time.sleep(1)
    response = client.check_status(message_id)
    print(response['status'])

If you don't want to use a module, you can find the source code for the module on GitHub: https://github.com/sinch/python-sinch-sms

What's next?

In the coming months, we will start supporting incoming SMS and have a packaged solution for verifying phone numbers through SMS and calling. Stay tuned.

Happy SMSing!

sms-python-tutorial's People

Contributors

kwaimind avatar mgpopolo avatar spacedsweden avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.