# Confirm bookings by phone (/docs/recipes/booking-confirmation)

A restaurant (or clinic, or workshop) calls guests a few hours before their booking. Guests confirm or cancel by keypress or voice, and your system updates the booking.

## 1. Create the call [#1-create-the-call]

```js
await fetch("https://api.callhuman.es/v1/calls", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.CALLHUMAN_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": `booking-${booking.id}-reminder`,
  },
  body: JSON.stringify({
    to: booking.phone,
    language: booking.language ?? "en",
    message: `Hi! This is La Plaza about your table for ${booking.people} tonight at ${booking.time}.`,
    options: [
      { label: "Confirm", reply: "Perfect, see you tonight!" },
      { label: "Cancel", reply: "No problem, your booking is cancelled." },
    ],
    webhook_url: "https://laplaza.example/hooks/callhuman",
    metadata: { booking_id: booking.id },
  }),
});
```

## 2. What the guest hears [#2-what-the-guest-hears]

<CallTranscript lines={[{"from":"callhuman","kind":"message","text":"Hi! This is La Plaza about your table for 4 tonight at 8:30 pm."},{"from":"callhuman","kind":"menu","text":"Press 1 or say “confirm”. Press 2 or say “cancel”."},{"from":"person","via":"voice","text":"Yes, we'll be there, don't cancel it"},{"from":"callhuman","kind":"reply","text":"Perfect, see you tonight!"}]} />

## 3. Receive the answer [#3-receive-the-answer]

```js
app.post("/hooks/callhuman", express.raw({ type: "application/json" }), async (req, res) => {
  if (!isValidSignature(req)) return res.sendStatus(401); // see /docs/webhooks
  const call = JSON.parse(req.body.toString("utf8"));
  const bookingId = call.metadata.booking_id;

  if (call.status === "answered" && call.option_label === "Confirm") await confirmBooking(bookingId);
  else if (call.status === "answered" && call.option_label === "Cancel") await cancelBooking(bookingId);
  else await flagForStaff(bookingId); // not answered, or nothing chosen

  res.sendStatus(200);
});
```

## Tips [#tips]

- Call **the same day**, 2–4 hours before: that's when no-shows can still be replaced.
- Use the guest's language with `language`.
- Unanswered calls are retried twice and never count towards your plan.