How To Make Message Sender Using Python.
In this blog, you’ll learn to make message sender using Python programming language.
First you’ll need to visit Fast2SMS to get the message API.
After visiting the website create your account using your email id and phone number.
After verification on the home page you’ll see Dev API. Click on that and there you’ll see an authorization key copy and paste the key in your python program.
Below you’ll find the source code for message sender using python.
Source Code
import requests
import json
from tkinter import *
from tkinter.messagebox import showinfo, showerror
def send_sms(number, message):
url = ‘https://www.fast2sms.com/dev/bulk’
params = {
‘authorization’: ‘Paste your authorization key here’,
‘sender_id’: ‘FSTSMS’,
‘message’: message,
‘language’: ‘english’,
‘route’: ‘p’,
‘numbers’: number
}
response = requests.get(url, params=params)
dic = response.json()
print(dic)
return dic.get(‘return’)
def btn_click():
num = textNumber.get()
msg = textMsg.get(“1.0”, END)
r = send_sms(num, msg)
if r:
showinfo(“Send Success”, “Successfully sent”)
else:
showerror(“Error”, “Something went wrong..”)
#Creating GUI
root = Tk()
root.title(“Message Sender “)
root.geometry(“400×550”)
font = (“Helvetica”, 22, “bold”)
textNumber = Entry(root, font=font)
textNumber.pack(fill=X, pady=20)
textMsg = Text(root)
textMsg.pack(fill=X)
sendBtn = Button(root, text=”SEND SMS”, command=btn_click)
sendBtn.pack()
root.mainloop()
Do Read: How To Use WhatsApp Payment Step By Step Guide
Paste the above code in your python ide, interpreter, or any code editor which you use.
You’ll see Rs.50 in your fast2sms wallet. Per message you send you’ll be charged Rs. 0.20.
Note Very Important: Do not use this service to send personal messages. Only promotional messages should be sent. If personal messages are sent Fast2SMS will block you authorization code permanently and you’ll not be able to use this service.
Pingback: FASTag Becomes Compulsory - Daily Blog day
Pingback: Secret Santa gift ideas drawnames online | Secret Santa Python