<< Home | Tech
Built an open-source WhatsApp agent for voice and images
| Area | Tech |
| AI used | LangGraph |
| Source | r/AI_Agents |
| Posted | 2026-11-20 |
The move
Deploy a LangGraph agent to WhatsApp using a keyed hash of the chat ID to maintain conversation history without a database.Steps
- Set up a LangGraph agent in a single file.
- Use a keyed hash of the WhatsApp chat ID as the thread ID.
- Implement summarizationMiddleware to compact older messages.
- Connect the agent to WhatsApp using the WAHA gateway.
- Limit image generation to one call per message run.
Prompt for your AI
Act as a conversational assistant for WhatsApp. Process incoming voice notes by transcribing them, analyze attached photos, and maintain context for each unique chat thread. If asked for an image, generate one using [Image Generation Tool] and send it back. Summarize older messages to keep the conversation history concise.
What happened
The user built an open-source agent that connects to WhatsApp via a QR code. The agent processes voice notes, images, and text while maintaining conversation context through LangGraph threads. It uses summarization to manage long-term chat history and limits image generation to control costs.Watch out
Using unofficial WhatsApp gateways like WAHA can lead to account bans, so use a spare phone number. The system currently drops messages if a second message arrives while the first is still processing.Give it to your agent
Read https://howtheyuse.ai/p/built-an-open-source-whatsapp-agent-for-voice-and-images.md and help me do this.