• Stars
    star
    120
  • Rank 290,273 (Top 6 %)
  • Language
    Python
  • Created almost 4 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

It is a python script to send automated bulk WhatsApp messages to multiple recipients from an excel sheet at once.

Python Automated Bulk WhatsApp Messages

It is a python script that sends WhatsApp message automatically from WhatsApp web application with saved contact numbers. It can be configured to send advertising messages to customers. It read data from an excel sheet and send a configured message to people.

Note

This is for saved contact numbers only if you want to send whatsapp bulk messages to unsaved or without saving the contact numbers. You may prefer another repository.

Important

  • WhatsApp Business released API on May 2022, no longer needed this repository. You can accomplish your same requirements through WhatsApp Business APIs.

Prerequisites

In order to run the python script, your system must have the following programs/packages installed and the contact number should be saved in your phone (You can use bulk contact number saving procedure of email). There is a way without saving the contact number but has the limitation to send the attachment.

Approach

  • User scans web QR code to log in into the WhatsApp web application.
  • The script reads a customized message from excel sheet.
  • The script reads rows one by one and searches that contact number in the web search box if the contact number found on WhatsApp then it will send a configured message otherwise It reads next row.
  • Loop execute until and unless all rows complete.

Note: If you wish to send an image instead of text you can write attachment selection python code.

Legal

  • This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by WhatsApp or any of its affiliates or subsidiaries. This is an independent and unofficial software. Use at your own risk. Commercial use of this code/repo is strictly prohibited.

Code

# Program to send bulk customized message through WhatsApp web application
# Author @inforkgodara

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.common.exceptions import NoSuchElementException
import pandas
import time

# Load the chrome driver
driver = webdriver.Chrome()
count = 0

# Open WhatsApp URL in chrome browser
driver.get("https://web.whatsapp.com/")
wait = WebDriverWait(driver, 20)

# Read data from excel
excel_data = pandas.read_excel('Customer bulk email data.xlsx', sheet_name='Customers')
message = excel_data['Message'][0]

# Iterate excel rows till to finish
for column in excel_data['Name'].tolist():
    # Locate search box through x_path
    search_box = '//*[@id="side"]/div[1]/div/label/div/div[2]'
    person_title = wait.until(lambda driver:driver.find_element_by_xpath(search_box))

    # Clear search box if any contact number is written in it
    person_title.clear()

    # Send contact number in search box
    person_title.send_keys(str(excel_data['Contact'][count]))
    count = count + 1

    # Wait for 3 seconds to search contact number
    time.sleep(3)

    try:
        # Load error message in case unavailability of contact number
        element = driver.find_element_by_xpath('//*[@id="pane-side"]/div[1]/div/span')
    except NoSuchElementException:
        # Format the message from excel sheet
        message = message.replace('{customer_name}', column)
        person_title.send_keys(Keys.ENTER)
        actions = ActionChains(driver)
        actions.send_keys(message)
        actions.send_keys(Keys.ENTER)
        actions.perform()

# Close Chrome browser
driver.quit()

Note: The script may not work in case if the HTML of web WhatsApp is changed.

Find it on youtube. https://youtu.be/NcWXpsczl3c

More Repositories

1

store-pos

It is java accounting software basically developed using javafx which has various modules like purchase, sales, receipts, payments, and journals.
Java
102
star
2

whatsapp-bulk-messages-without-saving-contacts

It is a python script that sends WhatsApp messages automatically from the WhatsApp web application without saved contact numbers.
Python
76
star
3

telegram-automated-bulk-messages

It is a python script that sends the Telegram messages automatically from the Telegram desktop application.
Python
58
star
4

javafx-login-registration-admin-panel

This is a JavaFX project which has user login, user registration, information and error notification, admin panel
Java
17
star
5

python-chat-application

It is a simple python socket-based chat application where communication established between a single server and client.
Python
14
star
6

java-point-of-sale

It is swing based java stand alone point of sale (POS). Its second version is in another repository. https://github.com/inforkgodara/java-pos
Java
13
star
7

sql-injection

It is a SQL injection vulnerable project with demonstration. It is developed using PHP and MySQL technologies. It also contains a youtube link where fully demonstrated SQL Injection.
PHP
9
star
8

java-pos

It is a desktop software to manage retail stores which is developed in java swing.
Java
7
star
9

purchase-orders

Web-based single page application (SPA) built in Laravel and Vue Js. Basically, it can be used for the order process of the Purchase Department in any organization.
Vue
7
star
10

automate-whatsapp-messages-python-script

This is a simple script that sends multiple WhatsApp messages using python script.
Python
6
star
11

automate-manual-repetitive-data-entry-tasks

This project contains demonstration of repetitive data entry tasks using python script as well as a form in which data is getting filled which is developed in JavaFX
Java
4
star
12

linux-privilege-escalation-scripts

The repository has scripts that search for possible paths to escalate privileges on Linux/Unix*/MacOS hosts.
Shell
3
star
13

xss-vulnerability

Explanation of Cross-site Scripting (XSS) with PHP mini project.
PHP
2
star
14

php-reverse-shell

It has PHP reverse shell code. It can be used to get a reverse shell from the target machine. Make sure to change the IP address of the attack box and port number.
PHP
2
star
15

generate-bulk-documents-python

It is a python script that generates bulk documents automatically from excel sheet data using replace concept.
Python
2
star
16

python-calculator

It is a basic python calculator.
Python
1
star
17

linear-search

A single class implementation of linear search
Java
1
star
18

python-network-scanner

This is a python script that scans ips in your network using TCP protocol.
Python
1
star
19

stack

It is a custom Stack JavaScript class.
JavaScript
1
star
20

insertion-sort

A single class implementation of insertion sort
Java
1
star
21

php-web-shell

A PHP web shell script that can be used to upload on the target box and access www-data user.
PHP
1
star
22

python-packet-sniffer

It is a small script which will allows you to monitor traffic running through local network.
Python
1
star
23

vehicle-recognition-for-weighbridge-scale

This is a python project that recognizes truck when truck comes at the weighbridge and take the picture and update on the WhatsApp number.
Python
1
star