Python

Sending SMS, MMS using Twilio

Twilio is a cloud communications platform. you can send text or pictures around the world. here is simple demo how to send sms using python

pip install twilio
from twilio.rest import TwilioRestClient

    account_sid = "your_twilio_account_sid"

    auth_token = "your_twilio_auth_token"

    # initialising twilio rest client

    client = TwilioRestClient(account_sid, auth_token)

    # sending your messge to twilio que

    msg = client.messages.create(body="Test message", to="reciever_number", from_="your_twilio_mobile_number")
client = TwilioRestClient(account_sid, auth_token)

    last_sms = client.messages.list()[0]

    print last_sms.status

    'delivered'

    print last_sms.body

    'Test message'
client = TwilioRestClient(account_sid, auth_token)

    message = client.messages.create(

        body="Test mms",  # Message body

        to="reciever_number",

        from_="your_twilio_mobile_number",

        media_url="http://micropyramid.com/logo.png"

    )
Share this Blog post