I sent an SMS with Python

I wondered if I could send an SMS from the script.

If you google, it seems that you should use a service called twilio (http://twilio.kddi-web.com/). There is also an API library (https://jp.twilio.com/docs/libraries). Convenient.

So, I tried to use it at once, but it seems that the phone number attached to the free account is not possible. Become a paid member (2000 yen charge). It seems that SMS cannot be used with a Japanese phone number (+81), so purchase an American phone number (+1) for 150 yen per month.

So far, fill in the necessary information in the following script, and hit the command with a bang, A message is sent to the to phone number. (1.5 yen per message)

twilio_sample.py


#!/usr/bin/env python2.7
#-*- coding: utf-8 -*-

from twilio.rest import TwilioRestClient

ACCOUNT_SID = '{ Your Account Sid }'
AUTH_TOKEN = '{Auth Token}'


def main():
    '''
    '''
    client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)

    message = client.messages.create(body='{ message }',
                                     to='{ phone number }',
                                     from_='{ Twilio number }')

    print message.sid

if __name__ == '__main__':

    main()


Recommended Posts

I sent an SMS with Python
I tried sending an SMS with Twilio
I tried sending an email with python.
I tried sending an email with SendGrid + Python
I tried fp-growth with python
I tried scraping with Python
I made blackjack with python!
Creating an egg with python
I tried gRPC with Python
I tried scraping with python
I made blackjack with Python.
I made wordcloud with Python.
I tried to implement an artificial perceptron with python
Cut out an image with python
I tried sending an email from Amazon SES with Python
I can't install python3 with pyenv-vertualenv
I tried web scraping with python.
I made a fortune with Python.
I liked the tweet with python. ..
I played with PyQt5 and Python3
Draw an illustration with Python + OpenCV
I want to debug with Python
I tried running prolog with python 3.8.2.
I made a daemon with Python
[Python] Send an email with outlook
I tried SMTP communication with Python
[Python] I made an image viewer with a simple sorting function.
I tried to make an image similarity function with Python + OpenCV
I get an error with import pandas.
[Python] Building an environment with Anaconda [Mac]
I tried scraping Yahoo News with Python
I made a character counter with Python
Note when creating an environment with python
I drew a heatmap with seaborn [Python]
Quickly create an excel file with Python #python
When I get an error with PyInstaller
I tried non-photorealistic rendering with Python + opencv
I want to analyze logs with Python
I want to play with aws with python
I tried a functional language with Python
I tried recursion with Python ② (Fibonacci sequence)
I installed and used Numba with Python3.5
What I did with a Python array
[Python] Quickly create an API with Flask
Scraping from an authenticated site with python
I made a Hex map with Python
Create an English word app with python
Send an email with Amazon SES + Python
Join an online judge with Python 3.x
I made a roguelike game with Python
I wanted to solve ABC172 with Python
Let's develop an investment algorithm with Python 1
I made a simple blackjack with Python
I made a configuration file with Python
#I tried something like Vlookup with Python # 2
I made a neuron simulator with Python
FizzBuzz with Python3
Scraping with Python
Statistics with python
Scraping with Python
Python with Go