Send Text Messages in Python

Send Text Messages in Python

This article explains how to send text message in python step by step using Fast2SMS. Fast2SMS is a popular bulk SMS service provider in India. Famous for its performance driven messaging services where you can send upto 50 messages for absolutely free !!

Prerequisites:

1.Install requests module using pip

pip install requests

2.Sign Up to Fast2MS

fast2sms.com

1.PNG

3.Navigate to DEV API section and copy the authorization & URL

3.PNG

Implementation

4.Open you python IDE & start coding

#import rquests module

import requests as rq

url = "https://www.fast2sms.com/dev/bulkV2"  #PASTE THE URL COPIED FROM IMAGE 2 POINT 3

querystring = {

   "authorization":" ",                 #PASTE THE AUTHORIZATION COPIED FROM IMAGE 2 POINT 2 (unique for everyone)
   "message":"This is test message",    #GIVE THE MESSAGE WHICH U WANT TO SEND
   "language":"english",                #LANGUAGE OF THE MESSAGE
   "route":"q",                         #FOR [QUICK SMS GIVE ROUTE AS 'q'] route differs for different types of SMS
   "numbers":"9080888421"               #ENTER THE NUMBER TO WHICH U WANT TO SEND THE SMS
   }

headers = 
   'cache-control': "no-cache"
}

response = rq.request("GET", url, headers=headers, params=querystring)

print(response.text)

Output:

C:\Users\welcom\Desktop\fastToSms>C:/Python/Python39/python.exe c:/Users/welcom/Desktop/fastToSms/main.py
{"return":true,"request_id":"9x3oyhmw5pgsn7j","message":["SMS sent successfully."]}

aiiiiiiiiiiiiiii.jpeg

--This is my first technical blog incase I missed anything or improvement needed let me know --