pywhatkit is a python module for sending Whatsapp messages at a certain time
Step 1:-
install pywhatkit library using command pip install pywhatkit
simple code to send one contact example1.py:-
import pywhatkit
# Asks a user to type a phonenumber to message
# Note, use international syntax,
# for example a US number would be +17576243392
print("\n")
print("Type a number to message:")
number = input()
# Asks for user to type a message
print("\n")
print("Type a message:")
message = input()
# Send a WhatsApp Message to the contact instantly (gives 10s to load web client before sending)
pywhatkit.sendwhatmsg_instantly(number, message, 10)
example to send "hi " message to multiple contacts :-
import pywhatkit
nums = ["+918149996597", "+919322437432"]
for x in nums:
print(x)
pywhatkit.sendwhatmsg(x, "hi", 12, 4,True,5)
Example reading with csv file & send message on Whatsapp :-
create csv file with column name 'phone_number' and in this column put your mobile number list.
import pandas as pd
import pywhatkit
df = pd.read_csv('data.csv')
data = list(df.Calories)
for x in data:
pywhatkit.sendwhatmsg(x, "hi", 13, 38,True,5)
....
or try following
# importing module
import pywhatkit
from pandas import *
# reading CSV file
data = read_csv("company_sales_data.csv")
# converting column data to list
nums = data['phone_number'].tolist()
for x in nums:
pywhatkit.sendwhatmsg(x, "hi", 18, 30)
Sign up here with your email
ConversionConversion EmoticonEmoticon