Python SMS Sender

buzonliao
Python 101
Published in
Oct 13, 2023
Photo by Pradamas Gifarry on Unsplash

This blog post offers a comprehensive guide to enhancing your communication capabilities using two powerful tools: Twilio and Ntfy. With Twilio, you can easily send SMS messages, while Ntfy enables you to receive notifications on your mobile device.

Twilio

from twilio.rest import Client

account_sid = 'account_sid'
auth_token = 'auth_token'
client = Client(account_sid, auth_token)

message = client.messages.create(
from_='your twillo number',
body='Hello Louis, Be patient. Sometimes you have to go through the worst to ge the best.',
to='your phone number'
)

print(message.sid)

ntfy

  • Download nyfy app on your phone
  • Subscribe to a topic you created via app
  • Send a message to that topic channel
import requests

requests.post("https://ntfy.sh/your_topic_channel",
data="Hello Louis 😀".encode(encoding='utf-8'))

Reference

--

--