Óscar Romero Quincoces

Projects / Research

Chatbot experiments

A WhatsApp bot answered by Claude

Prototype2026Personal project
Someone writes on WhatsAppAlguien escribe por WhatsApp Meta sends it to the webhookMeta lo envía al webhook FastAPI /webhookFastAPI /webhook reads the message from the payloadsaca el mensaje del payload Conversation historyHistorial de la conversación last 20 messages per number, in memory20 últimos mensajes por número, en memoria Claude writes the answerClaude escribe la respuesta Anthropic SDKSDK de Anthropic the reply goes backla respuesta vuelve to the same chatal mismo chat
Figure 1. How the prototype works, as a diagram: it only ran against simulated messages

Summary

The tests I ran before the production Telegram bot: a backend that receives WhatsApp messages through Meta's webhook, keeps each conversation's recent history and answers with Claude.

Python, FastAPI and the Anthropic SDK.

What it is

A small FastAPI backend for WhatsApp. One endpoint answers Meta's webhook verification; the other receives incoming messages, parses Meta's payload, keeps the last 20 messages of each conversation in memory and replies with Claude. It can be tested without Meta credentials by simulating the webhook with curl, and exposed through ngrok when it's time to connect the real number.

Why it exists

These were the tests I ran before building the Telegram bot that is now in production. For now Claude's reply shows up in the server log; sending replies back through Meta is left for when the real credentials are in place.

Figures

New WhatsApp messageMensaje nuevo de WhatsApp from one phone numberdesde un número de teléfono Recent historyHistorial reciente of that conversation, in memoryde esa conversación, en memoria Claude writes the replyClaude escribe la respuesta with the whole contextcon todo el contexto Reply sent and savedRespuesta enviada y guardada back into the historyde vuelta al historial
Figure 2. What goes to Claude with each message: the new text plus that conversation’s recent history

Built with

PythonFastAPIAnthropic SDKWhatsApp Cloud APIngrok