All Projects → VISWESWARAN1998 → Simple Yet Hackable Whatsapp Api

VISWESWARAN1998 / Simple Yet Hackable Whatsapp Api

Licence: apache-2.0
There is no official WhatsApp API. Here is a simple python class which satisfies the need.

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Simple Yet Hackable Whatsapp Api

kirimwa.id
Layanan gratis untuk mengirimkan pesan WhatsApp tanpa menyimpan nomor kontak
Stars: ✭ 36 (-90.06%)
Mutual labels:  whatsapp
whatsapp-clone
A full-stack real-time WhatsApp clone using reactjs and firebase
Stars: ✭ 61 (-83.15%)
Mutual labels:  whatsapp
Im
Loqui IM allows you to use all your chat accounts in just one FirefoxOS or Ubuntu Touch app.
Stars: ✭ 306 (-15.47%)
Mutual labels:  whatsapp
dark
🌛 Dark themes / mode for Rambox, Franz or Ferdi messaging services
Stars: ✭ 93 (-74.31%)
Mutual labels:  whatsapp
WAPI
The WhatsApp API
Stars: ✭ 36 (-90.06%)
Mutual labels:  whatsapp
Whatsapp Web
WhatsApp chat from [command line, terminal, console, cli] 📵
Stars: ✭ 259 (-28.45%)
Mutual labels:  whatsapp
Whatsapp-Botto-Void
A fully Object Oriented WhatsApp bot built with TypeScript
Stars: ✭ 64 (-82.32%)
Mutual labels:  whatsapp
Zuck.js
A javascript library that lets you add stories EVERYWHERE.
Stars: ✭ 3,396 (+838.12%)
Mutual labels:  whatsapp
WhatsApp-Group-Contacts-Scraper
The tool to scrap whatsapp group contacts from https://web.whatsapp.com
Stars: ✭ 32 (-91.16%)
Mutual labels:  whatsapp
Whatsapp Play
Command line software through which you can play with your WhatsApp. It is having different options to play with your WhatsApp like message blast, online tracking, whatsapp chat..
Stars: ✭ 289 (-20.17%)
Mutual labels:  whatsapp
electronim
Electron based multi IM (Instant Messaging) client
Stars: ✭ 50 (-86.19%)
Mutual labels:  whatsapp
wappdriver
Wondering how to send WhatsApp messages using Python using only 3 lines of code? You have come to the right place!
Stars: ✭ 40 (-88.95%)
Mutual labels:  whatsapp
Cordova Plugin Native Keyboard
🎹 Add a Slack / WhatsApp - style chat keyboard to your Cordova app!
Stars: ✭ 271 (-25.14%)
Mutual labels:  whatsapp
CVE-2020-11932
Double-Free BUG in WhatsApp exploit poc.
Stars: ✭ 82 (-77.35%)
Mutual labels:  whatsapp
Whatspup
🔳 WhatsApp chat from commandline/console/cli using GoogleChrome puppeteer
Stars: ✭ 310 (-14.36%)
Mutual labels:  whatsapp
Whatsapp-Group-Contacts-Scraper
How to scrap whatsapp group contacts from https://web.whatsapp.com/
Stars: ✭ 65 (-82.04%)
Mutual labels:  whatsapp
Pywhatsapp
Python Automation using selenium & Scheduling of messages and media
Stars: ✭ 257 (-29.01%)
Mutual labels:  whatsapp
Statusstories
Status Stories = Snapchat stories, Instagram stories, Whatsapp Statuses, Facebook Messenger Stories.
Stars: ✭ 317 (-12.43%)
Mutual labels:  whatsapp
Falconmessenger
🌟🌟🌟🌟🌟 Falcon Messenger is a Fast and Beautiful cloud-based messaging app. With iOS and IPadOS Support. Available on the App Store.
Stars: ✭ 310 (-14.36%)
Mutual labels:  whatsapp
Python Wechaty
Python Wechaty is a Conversational RPA SDK for Chatbot Makers written in Python
Stars: ✭ 286 (-20.99%)
Mutual labels:  whatsapp

Simple-Yet-Hackable-WhatsApp-api

HitCount

Using This API you can achieve many things in less than 5 lines of code

Sending a message with an emoji:

from whatsapp import WhatsApp
whatsapp = WhatsApp(10)
print(whatsapp.send_message("Name","❤️ Good!"))  

Result:
Image

Running from an existing session: It it very difficult for us to scan the QR code for logging in everytime if the session is not saved, you can avoid it by adding the session parameter like this,

# SWAMI KARUPPASWAMI THUNNAI

import os
from whatsapp import WhatsApp

whatsapp = WhatsApp(100, session="mysession")
whatsapp.send_document("Thamarai", os.path.join(os.getcwd(), "message.txt"))

Your data will be saved into mysession folder from the above example. Make sure you protect your session folder.

Getting the status message of a person:

from whatsapp import WhatsApp
whatsapp = WhatsApp(10)
print(whatsapp.get_status("Name"))

Getting last seen of a person:

from whatsapp import WhatsApp
whatsapp = WhatsApp(10)
print(whatsapp.get_last_seen("Name"))

Getting the no of participants in the group:

from whatsapp import WhatsApp
whatsapp = WhatsApp(10)
result = app.participants_count_for_group("The Night Ghost Company")

creating a new group and getting invite link

# SWAMI KARUPPASWAMI THUNNAI

from whatsapp import WhatsApp
import time

app = WhatsApp(100)
parameter1: group name, parameter 2: group members
app.create_group("group", ["Thamarai", "Jeeva"])
time.sleep(10)
print(app.get_invite_link_for_group("group"))

Join the group using invite link

# SWAMI KARUPPASWAMI THUNNAI

from whatsapp import WhatsApp

app = WhatsApp(10)
app.override_timeout(30)
app.join_group("https://chat.whatsapp.com/4AIA2B3GuLp4RJOKF0M8zY")
app.send_blind_message("I am in :)")

Exiting the group

# SWAMI KARUPPASWAMI THUNNAI

from whatsapp import WhatsApp

app = WhatsApp(100)
app.exit_group("X-Test")

Sending Anonymous messages [WHATSAPP WILL BAN YOUR PHONE NUMBER IF YOU SEND MANY ANONYMOUS MESSAGES] Note: The phone number should not contain spaces and special characters(+, -) but shall contain country code. Example: +91-861 123 4567 should be formatted to 918611234567

# SWAMI KARUPPASWAMI THUNNAI

from whatsapp import WhatsApp

app = WhatsApp(10)
app.send_anon_message("91XXXXXXXXXX", "I am sorry for what is happening sir! But I have no other choice.")

Sending Messages to multiple participants Sometimes we need to send messages to multiple persons who may or may not be in our contact list. So we need to a combination of both send_message and send_anon_message. Here is an example where we get the contact numbers from a group and sending messages to individual persons in that group.

# SWAMI KARUPPASWAMI THUNNAI

from whatsapp import WhatsApp
import time

app = WhatsApp(100)
app.override_timeout(30)
participants = app.get_group_participants("GDG")
print(participants)

for participant in participants:
    print("Sending: ", participant)
    time.sleep(1)
    try:
        app.send_message(participant.strip(), "Hello, I'm a bot. And this is a research. Please ignore me and dont ping back")
    except Exception as e:
        print(e)
        participant = participant.replace("+", "")
        participant = participant.replace(" ", "")
        app.send_anon_message(participant.strip(), "Hello, I'm a bot. And this is a research. Please ignore me and dont ping back")
    app.goto_main()

Sending pictures to a person:

# Note of Thanks: This part of code have been taken from WhatsApp Assistant bot by Jean-Claude Tissier(@jctissier).
# Github repo-link: https://github.com/jctissier/whatsapp-assistant-bot
# License: MIT
app.send_picture("Vignesh", os.getcwd()+"/pic.jpg")

Sending documents to a person:

# SWAMI KARUPPASWAMI THUNNAI

import os
from whatsapp import WhatsApp

whatsapp = WhatsApp(100)
whatsapp.send_document("Thamarai", os.path.join(os.getcwd(), "message.txt"))

Clearing the chat:

# SWAMI KARUPPASWAMI THUNNAI

from whatsapp import WhatsApp

whatsapp = WhatsApp(100)
whatsapp.clear_chat("Test")

Getting usernames with unread messages: Will return the list of usernames for which we have yet to reply that person. Increase the count of scrolls according to your needs.

# SWAMI KARUPPASWAMI THUNNAI

from whatsapp import WhatsApp

whatsapp = WhatsApp(100, session="mysession")
print(whatsapp.unread_usernames(scrolls=1000))

and we will receive an output as a Python list. Something like this,

['Ziv Freelance Employer', 'Vignesh', 'InstagramTest', '+91 9xx36 8xxx2', 'Sundar Sir', '+91 xxx47 8xxx9']

Getting the last sent messages for a username:

# SWAMI KARUPPASWAMI THUNNAI

from whatsapp import WhatsApp

whatsapp = WhatsApp(100, session="mysession")
messages = whatsapp.get_last_message_for("Thamarai")
print(messages)

Note: I am still working on it and it might break.

Interesting use cases:

Replying to all stale messages:

# SWAMI KARUPPASWAMI THUNNAI

from whatsapp import WhatsApp

whatsapp = WhatsApp(100, session="mysession")
usernames = whatsapp.unread_usernames(scrolls=1000)
for username in usernames:
    try:
        whatsapp.send_message(username, "Hello I am a bot, apologies that my creator hasn't replied to you yet. please ping again. ")
        whatsapp.send_blind_message("Know more about me: https://github.com/VISWESWARAN1998/Simple-Yet-Hackable-WhatsApp-api")
    except:
        print("You don't have permission to send message to this group/person")

Note: Ir just automated the whatsapp, Nothing More, Nothing Less. This program is Licensed under Apache 2.0.

Thank you for so many stars on this project, you can support me in follwing ways,

  1. Paypal: [email protected]
  2. 1 GitHub follower = 1 supporter for me to get recogonized.
  3. LinkedIn skill Endorsement: https://www.linkedin.com/in/visweswaran-nagasivam-975a8b167/
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].