Skip to content

A quick script to send an SMS message to a list of recipients using Termux-API and Python3 on an Android device.

License

Notifications You must be signed in to change notification settings

mauricecyril/termux-send-sms-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Termux Send SMS Script

A quick script to send an SMS message to a list of recipients using Termux-API and Python3 on an Android device.

No Longer WORKS with Latest Android PIE Updates.

Installation Instructions

  1. Install the Termux app from the Google Play Store: https://play.google.com/store/apps/details?id=com.termux

  2. Once installed, run Termux

  3. Update Apt

apt-get update
  1. Install Termux-API
apt-get install termux-api
  1. Test the SMS send command in Termux and allow Android to access the SMS functions on the phone
termux-sms-send -n [replace with phone number] [SMS message]
  1. Install Python
apt-get install python
  1. Install Nano text editor
apt-get install nano
  1. Create the python Script
nano sendsms.py
  1. Write the script
import subprocess

# Add Entries to the address book dictionary. Key = Name, Value = Phone Number
addressbook = {"Name1" : "+15551234567"
                "Name2" : "+15551234568"
                }
                
# Loop through the addressbook dictionary and send each number the message
for (k,v) in addressbook.items():
    
    # SMS Message Template (try to keep to within 150 characters)
    smsmessage = str("Hi " + k + " your phone number is " + v)
    
    # Use Subprocess Run Function to send SMS
    subprocess.run(["termux-sms-send", "-n", phonenumber, smsmessage])
    
    # Print confirmation of each send
    print("Sent Message to " + k + " via " + v)


# Print end of process message
print("Message sending complete")
  1. Save the python script and exit nano by pressing CTRL+X in Nano

  2. Run the script in Termux

python sendsms.py

The termux terminal will display the following

Sent Message to Name1 via +15551234567
Sent Message to Name2 via +15551234568
Message sending complete

About

A quick script to send an SMS message to a list of recipients using Termux-API and Python3 on an Android device.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages