WhatsApp Python Automation

WhatsApp Python Automation

WhatsApp Messaging with MCP & Ollama This project integrates PraisonAI Agents with Ollama (llama3.2) and a Go-based WhatsApp bridge. It allows you to send WhatsApp messages using natural language through a local REST API, powered by an LLM and custom MCP tools.

AakibAnsarime

Developer Tools
Visit Server

README

WhatsApp Python Automation

This is a Python-based WhatsApp automation tool that allows you to send messages programmatically using WhatsApp Web's interface.

Features

  • Send messages to individual contacts or groups
  • Easy to set up and use
  • Uses Python for automation
  • Works with WhatsApp Web

Prerequisites

  • Python 3.6 or higher
  • Go (version 1.16 or higher)
  • Chrome/Firefox browser
  • Active WhatsApp account
  • Internet connection

Windows-Specific Requirements

For Windows users, additional setup is required:

  1. Install Go:

    • Download Go from the official website
    • Run the installer
    • Add Go to your system PATH if not done automatically
    • Verify installation by running go version in Command Prompt
  2. Enable CGO:

    • CGO is required for the WhatsApp bridge to work properly
    • Open Command Prompt and run: go env -w CGO_ENABLED=1
  3. Install C Compiler:

    • Download and install MSYS2
    • Open MSYS2 and run: pacman -S mingw-w64-x86_64-gcc
    • Add C:\msys64\mingw64\bin to your system PATH

Installation

  1. Clone this repository:
git clone [your-repository-url]
cd whatsapp-python
  1. Install the required dependencies:
pip install -r requirements.txt

Usage

  1. Navigate to the project directory:
cd whatsapp-bridge
  1. Run the WhatsApp bridge:
go run main.go
#this will start whatsapp mcp server
  1. When running for the first time, you'll need to:

    • Scan the QR code with your WhatsApp mobile app
    • Wait for the authentication process to complete
    • Keep your phone connected to the internet
  2. To send a message, use the following format:

python whatsapp_message.py
#This will run ai with our mcp connection
send message to "recipient_name" "your message"

eg: send message to chau say hi  /#remember to add contact manually to json so it will load it

How It Works

The application works by:

  1. Automating a web browser session
  2. Connecting to WhatsApp Web
  3. Authenticating via QR code (first time only)
  4. Locating the recipient in your contacts
  5. Sending the specified message using ollam

Important Notes

  • Keep your WhatsApp phone app connected to the internet
  • Don't close the server in terminal while sending messages
  • Make sure the recipient is in your WhatsApp contacts
  • The session needs to be re-authenticated periodically like 20 days
  • For Windows users, ensure CGO is enabled and C compiler is properly configured

Troubleshooting

If you encounter issues:

  1. Ensure you have a stable internet connection
  2. Verify that your WhatsApp account is active
  3. Make sure the recipient's name matches exactly as it appears in your contacts
  4. Try re-running the script if authentication fails

Windows-Specific Issues

If you encounter errors like:

  • Binary was compiled with 'CGO_ENABLED=0': Make sure CGO is enabled
  • gcc: command not found: Verify MSYS2 installation and PATH
  • missing go.sum entry: Run go mod tidy in the whatsapp-bridge directory

Contributing

Feel free to:

  • Report bugs
  • Suggest features
  • Submit pull requests

License

This project is licensed under the MIT License - see the LICENSE file for details.

Disclaimer

This tool is for educational purposes only. Please use responsibly and in accordance with WhatsApp's terms of service.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

Linear MCP Server

A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Featured
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python