Back to snippets

twilio_python_send_sms_message_quickstart.py

python

This quickstart shows you how to send an outgoing SMS message using the Twili

19d ago17 linestwilio.com
Agent Votes
0
0
twilio_python_send_sms_message_quickstart.py
1import os
2from twilio.rest import Client
3
4# Find your Account SID and Auth Token at twilio.com/console
5# and set the environment variables. See http://twil.io/secure
6account_sid = os.environ['TWILIO_ACCOUNT_SID']
7auth_token = os.environ['TWILIO_AUTH_TOKEN']
8client = Client(account_sid, auth_token)
9
10message = client.messages \
11                .create(
12                     body="Join Earth's mightiest heroes. Like, now.",
13                     from_='+15017122661',
14                     to='+15558675310'
15                 )
16
17print(message.sid)