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

# Appointment management (Google Calendar)

> A phone receptionist that checks your schedule and books the appointment in Google Calendar

<Note>
  **Related workflows:** [Check availability (Google Calendar)](/en/templates/flows/check-availability) and [Create appointment (Google Calendar)](/en/templates/flows/create-appointment).
</Note>

## What it does

It answers your customers' calls, identifies which location they want to be seen at, checks the free slots in your calendar, and books the appointment.

It's a [single prompt](/en/build/agents/single-prompt) agent in English, with an unhurried tone aimed at appointment management for your business.

### How the call goes

1. **It places the customer.** It asks which location they want to go to and, if they can't name it, works it out from the knowledge base. This step is optional: changing the prompt is enough for the agent to handle appointments for a single location.
2. **It checks the schedule.** It calls `check_availability` with the opening and closing time of the day the customer asks about, and gets back the free slots already worked out, in local time. If the customer changes the day or the time, it calls the tool again.
3. **It offers slots and collects the details.** It only proposes times that fit entirely inside a single free slot: if the one the customer asked for doesn't fit, it offers the two closest alternatives. Once the customer picks one, it asks for their name and phone number.
4. **It books the appointment.** It calls `create_appointment`, which re-checks the slot before creating the event. If another appointment came in for that slot during the conversation, the workflow creates nothing and the agent offers a different time.

## What you need

* A Google Calendar [connection](/en/platform/connections)
* The [Check availability (Google Calendar)](/en/templates/flows/check-availability) workflow
* The [Create appointment (Google Calendar)](/en/templates/flows/create-appointment) workflow
* A [knowledge base](/en/build/knowledge-bases) with your locations: address, neighborhood, and hours (optional)

## Getting started

<Steps>
  <Step title="Create the agent">
    In **Agents**, click **Create Agent**, select the template, and click **Use template**.
  </Step>

  <Step title="Fill in the two variables">
    | Variable           | What to enter        |
    | ------------------ | -------------------- |
    | `<<agent_name>>`   | The assistant's name |
    | `<<company_name>>` | Your company's name  |
  </Step>

  <Step title="Adjust the hours and the duration">
    In the prompt, edit the **Opening hours** block with your location's real hours: that's where the agent takes the opening and closing time it passes to `check_availability` from, so if it doesn't match, neither will the slots it offers.

    The appointment length ships fixed at 15 minutes and appears in two places in the prompt: in the `check_availability` instructions, next to the example of how late you can offer within a slot, and in the `create_appointment` ones. Change it in both.
  </Step>

  <Step title="Set up the two tools">
    Create the [Check availability (Google Calendar)](/en/templates/flows/check-availability) and [Create appointment (Google Calendar)](/en/templates/flows/create-appointment) workflows from the **Workflow** section under **Tools**. Both have to point at the **same calendar**: otherwise the agent offers slots from one schedule and books the appointment in another.

    This is how you create a workflow without leaving the agent:

    <video autoPlay loop muted playsInline controls className="w-full rounded-xl" src="https://mintcdn.com/diga/72-yaa6Fq0Y_EP9U/videos/crear_flujo_desde_agente.mp4?fit=max&auto=format&n=72-yaa6Fq0Y_EP9U&q=85&s=6b8c39e990334841834235a43cd9b9a0" data-path="videos/crear_flujo_desde_agente.mp4" />

    The names must match exactly — `check_availability` and `create_appointment` — because the prompt calls them literally.

    Both workflows ship with the time zone set to `Europe/Madrid`. If you operate in a different one, check it before moving on: it's three fields in [Check availability](/en/templates/flows/check-availability#check-the-time-zone) and two in [Create appointment](/en/templates/flows/create-appointment#check-the-time-zone).
  </Step>

  <Step title="Publish both workflows">
    Each workflow has to be [published](/en/build/flows/creating-workflows#draft-vs-published). If you skip this step, the agent won't be able to use them.
  </Step>

  <Step title="Link the knowledge base (optional)">
    Upload your location list and link it to the agent. The agent uses it to place customers who can't name the location they go to.
  </Step>

  <Step title="Test and publish">
    Make a [test call](/en/build/agents/test-calls) booking a real appointment, check it shows up in the calendar at the right time, and [publish the agent](/en/build/agents/version-control). To make the test call, you have to click **Test**.
  </Step>
</Steps>

### Example conversation

```
Agent: This is Gema, an agent from Diga. How can I help you?
Customer: Good morning, I'd like to book an appointment.
Agent: Of course. Which location would you like to go to?
Customer: The one next to the market.
Agent: [checks the knowledge base]
       That's the Chamberí location, on calle Fuencarral. What day suits you?
Customer: Tomorrow morning, if possible.
Agent: Let me check the schedule for a moment.
       [calls check_availability]
       Tomorrow, Tuesday, I have nine thirty, ten fifteen, and eleven free.
       Which would you prefer?
Customer: Ten fifteen.
Agent: Perfect. Could you give me your full name?
Customer: Manuel Ortega Ruiz.
Agent: And a contact phone number?
Customer: Six one one, two two, three three, four four.
Agent: [calls create_appointment]
       All set, Manuel. I've booked you tomorrow, Tuesday, at ten fifteen
       at the Chamberí location. Anything else?
Customer: No, thank you very much.
Agent: Thank you. Have a good day.
```

## Before publishing

Keep in mind the following points when setting up your template:

* **Canceling or rescheduling appointments:** if you need this, you'll have to add it yourself; the agent says it will handle it, but there's no tool behind that.
* **Transferring or hanging up:** add the [transfer tool](/en/build/agents/call-tools) if you want the agent to be able to do this; by default it has neither.
* **Handling several languages:** switch the [language selector](/en/build/agents/call-customization#language) to **Multilingual** so the agent detects each customer's language and replies in that same language. By default it only speaks English, even if the customer switches language.
* **Separate schedules per location:** duplicate both workflows and give them specific names, adjusting the prompt accordingly. By default, the agent works against a single calendar: it can place customers across several locations through the knowledge base, but every appointment lands in the same schedule.

## Next Steps

<CardGroup cols={2}>
  <Card title="Check availability (Google Calendar)" icon="bolt" href="/en/templates/flows/check-availability">
    The workflow that queries the free slots.
  </Card>

  <Card title="Create appointment (Google Calendar)" icon="calendar-plus" href="/en/templates/flows/create-appointment">
    The workflow that creates the event.
  </Card>

  <Card title="How to write prompts" icon="wand-sparkles" href="/en/build/agents/single-prompt">
    If you want to modify the template's prompt.
  </Card>
</CardGroup>
