Use caseYour customers book appointments on WhatsApp, and your calendar fills up.
A customer writes that they want an appointment. The AI agent asks for the reason and the city, your app offers three free slots from your calendar, then books the one they pick and confirms it.
The request, the slots, the booking: 38 seconds.
From the request in Claude Code to the booked appointment, on a real WhatsApp conversation.
How it flows.
Step by step, for real.
- 1
The agent’s two actions
Claude Code sets them with
set_agent_action: “Appointment request”, which notes the reason and the city, and “Slot choice”, which notes the slot picked. The agent triggers them on its own, as the conversation goes. - 2
The request arrives, signed
Your route, declared with
create_webhook_endpoint, receivesagent.action(unchecked by default, you tick it on purpose) and checks its signature: a request without a signature is refused. - 3
Three free slots
Your app reads your calendar near the city given and answers the customer with
POST /v1/messages/whatsapp: they just wrote, the 24-hour window is open, no template is needed. - 4
The slot booked
The customer picks one; the agent triggers “Slot choice”, and your app books once per request, then confirms on WhatsApp.
What you type in Claude Code
With the plugin installed, one sentence is enough: Claude Code sets up the agent, writes the route and your calendar link, and tests.
when a customer asks for an appointment on whatsapp, the AI agent gets the reason and city, my app (route /api/webhooks/messagingme) offers 3 free slots from the calendar (lib/calendar.ts), and when they pick one we book it and confirm on whatsapp
The route, as Claude Code writes it
import { verifyWebhook, WebhookVerificationError } from '@messagingme/sdk';
import { messagingme } from '../../../../lib/messagingme';
import { book, offerSlots } from '../../../../lib/calendar';
// Subscribed to agent.action: the AI agent’s two actions, Appointment request (fields reason and city) and Slot
// choice (field slot). The type is unchecked by default on a webhook address.
export async function POST(req: Request) {
// The RAW body: the signature covers its bytes.
const body = await req.text();
let event;
try {
event = await verifyWebhook({ secret: process.env.MESSAGINGME_WEBHOOK_SECRET!, headers: req.headers, body });
} catch (e) {
if (e instanceof WebhookVerificationError) return new Response(null, { status: 401 });
throw e;
}
if (event.type !== 'agent.action' || !event.data.contact) return new Response(null, { status: 204 });
const { action, fields, contact } = event.data;
let text: string | null = null;
if (action.name === 'Appointment request') text = await offerSlots(String(fields.city ?? ''), 3);
if (action.name === 'Slot choice' && fields.slot !== undefined) text = await book(event.id, String(fields.slot));
if (text) await messagingme.POST('/v1/messages/whatsapp', { body: { contactId: contact.id, text } });
// Answer fast (under 10 s): a slow job runs after, otherwise the webhook is retried.
return new Response(null, { status: 204 });
}
app/api/webhooks/messagingme/route.ts · all the code in the guide
What you pay.
- The Free plan is enough to start: 100 contacts, the API and the MCP server included; beyond that, Pro.
- The AI agent is paid from the prepaid AI credit, per answer.
- Meta bills your business directly for each reply sent in the 24-hour window, according to its rate card and the customer’s country.
Frequently asked questions.
Is a template approved by Meta needed?
No: the customer writes first, and your app answers within the 24-hour window their message opens.
Can the same slot be booked twice?
No: booking happens once per request (the same event received twice books once), and your calendar says what is free.
What if the customer asks again the same day?
Each action fires at most once a day, per customer and per action: a second request the same day does not reach your app, the agent answers on its own.
How much does it cost?
Free includes the API and the MCP server. The AI agent is paid from the prepaid AI credit, and Meta bills each reply sent in the 24-hour window, according to its rate card and the customer’s country.
Open appointment booking today.
The plugin in two commands, then the sentence above in Claude Code. No account to create.