Send an SMS from your Android phone with Python

June 03, 20236 min read

In an era dominated by social media, instant messaging apps, and ever-evolving communication technologies, it's easy to overlook the humble yet remarkably resilient Short Message Service (SMS). Since its inception in the 1990s, SMS has stood the test of time, remaining one of the most widely used and reliable means of mobile communication.

Whether you're a business owner looking to optimize your communication strategy, a developer seeking to integrate SMS functionality into your applications, or simply intrigued by the enduring charm of SMS, this article will explain how to setup your Android phone to send SMS messages.


  • Basic understanding of Python.
  • An Android phone.
  • Python installed on your computer.

Step 1: Get your API Key

Create an account on and copy your API key from the settings page

Step 2: Install the httpSMS android app

⬇️ Download and install the httpSMS android app on your phone and sign in using your API KEY which you copied above. This app listens for SMS messages received on your android phone.

Step 3: Writing the code

Now that you have setup your android phone correctly on httpSMS, you can write the python code below in a new file named This code will send and SMS and after running the script via your Android phone to the recipient phone number specified in the payload.

import requests
import json

api_key = "" # Get API Key from

url = ''

headers = {
    'x-api-key': api_key,
    'Accept': 'application/json',
    'Content-Type': 'application/json'

payload = {
    "content": "This is a sample text message sent via python",
    "from": "+18005550199", # This is the phone number of your android phone */
    "to": "+18005550100" # This is the recipient phone number */

response =, headers=headers, data=json.dumps(payload))

print(json.dumps(response.json(), indent=4))


Run the code above with the command python and check the phone specified in the to field of the payload to verify that the message has been received successfully.


Congratulations, you have successfully configured your android phone to send SMS messages via python. You can now reuse this code to send SMS messages from your python applications.

If you are also interested in forwarding incoming SMS from your android phone to your server, checkout our SMS forwarding guide.

Until the next time✌️

Acho Arnold