> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getbutter.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Outbound Appointment Setter

> Programmatically trigger calls to confirm appointments

This recipe shows how to trigger outbound calls to a list of customers to confirm their upcoming appointments.

## Goal

Call a customer, remind them of their appointment time, and ask for confirmation. If they confirm, we update our database (simulated via Tool).

## 1. Create the Tool

We need a tool to update the appointment status.

**Tool Config:**

```json theme={null}
{
  "name": "update_appointment",
  "description": "Updates the status of an appointment",
  "url": "https://api.your-backend.com/appointments/{appointment_id}",
  "method": "POST",
  "parameters": {
    "type": "object",
    "properties": {
      "appointment_id": {"type": "string"},
      "status": {"type": "string", "enum": ["confirmed", "cancelled", "rescheduled"]}
    },
    "required": ["appointment_id", "status"]
  }
}
```

## 2. Configure the Agent

The agent needs a prompt that accepts variables. We use `{{variable_name}}` syntax in our conceptual model, but in Butter AI, we inject variables via the `prompt_variables` parameter in the `make-call` request.

**System Prompt:**

```text theme={null}
You are calling {{customer_name}} to confirm their appointment at {{appointment_time}}.
- Verify you are speaking to {{customer_name}}.
- State the appointment time.
- Ask if they can make it.
- If yes, use the 'update_appointment' tool to set status to 'confirmed'.
- If no, ask if they want to reschedule.
```

## 3. Trigger the Call

When your backend logic determines a call is needed, hit the Butter AI API. Note how we pass the specific details for *this* customer in `prompt_variables`.

```bash theme={null}
curl -X POST "https://api.getbutter.ai/api/make-call" \
  -H "Content-Type: application/json" \
  ...
  -d '{
    "call_to": "+15550001111",
    "call_from": "+15559998888",
    "agent_id": "<AGENT_ID>",
    "prompt_variables": {
      "customer_name": "John Doe",
      "appointment_time": "Tomorrow at 2 PM",
      "appointment_id": "appt_123"
    }
  }'
```

## 4. The Conversation Flow

1. **Bot**: "Hi, is this John Doe?"
2. **User**: "Yes, speaking."
3. **Bot**: "Great. I'm calling from Dr. Smith's office to confirm your appointment for Tomorrow at 2 PM. Can you still make it?"
4. **User**: "Yes, I'll be there."
5. **Bot**: *Calls `update_appointment` tool with status='confirmed'* -> "Perfect, we've marked you as confirmed. See you then!"
