- 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.
Content
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:
-
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 versionin Command Prompt
-
Enable CGO:
- CGO is required for the WhatsApp bridge to work properly
- Open Command Prompt and run:
go env -w CGO_ENABLED=1
-
Install C Compiler:
- Download and install MSYS2
- Open MSYS2 and run:
pacman -S mingw-w64-x86_64-gcc - Add
C:\msys64\mingw64\binto your system PATH
Installation
- Clone this repository:
git clone [your-repository-url]
cd whatsapp-python
- Install the required dependencies:
pip install -r requirements.txt
Usage
- Navigate to the project directory:
cd whatsapp-bridge
- Run the WhatsApp bridge:
go run main.go
#this will start whatsapp mcp server
-
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
-
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:
- Automating a web browser session
- Connecting to WhatsApp Web
- Authenticating via QR code (first time only)
- Locating the recipient in your contacts
- 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:
- Ensure you have a stable internet connection
- Verify that your WhatsApp account is active
- Make sure the recipient's name matches exactly as it appears in your contacts
- 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 enabledgcc: command not found: Verify MSYS2 installation and PATHmissing go.sum entry: Rungo mod tidyin 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.
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Serper MCP ServerA Serper MCP Server
DeepChatYour AI Partner on Desktop
WindsurfThe new purpose-built IDE to harness magic
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
ChatWiseThe second fastest AI chatbot™
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright McpPlaywright MCP server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题;
Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Amap Maps高德地图官方 MCP Server
CursorThe AI Code Editor
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Tavily Mcp