Twilio help build apps that communicate with everyone in the world. Voice & Video, Messaging and Authentication APIs for every application.
You can get an API key for free.
To send a message through Twilio, your application needs to make an HTTP POST request to Twilio with the following things:
To send an SMS, make an HTTP POST request to the Messages resource.
POST https://api.twilio.com/20xx-xx-xx/Accounts/xxxxxxx/Messages
Below is an example code to show how sending messeges with Twilio API will work.
# Download the twilio-python library from http://twilio.com/docs/libraries
from twilio.rest import TwilioRestClient
# Find these values at https://twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXX"
auth_token = "YYYYYYYYYYYYYYYYYY"
client = TwilioRestClient(account_sid, auth_token)
message = client.messages.create(
to = "+12316851234",
from_ = "+15555555555",
body = "Hello there!"
)
If the Twilio number supports MMS, then you can send and receive MMS also.
Below is code to send MMS through Twilio API.
message = client.messages.create(
to = "+12316851234",
from_ = "+15555555555",
body = "Hello there!",
media_url=[
'https://demo.twilio.com/owl.png',
'https://demo.twilio.com/logo.png'
])