Skip to content

Workflow examples #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
554aec0
feat: add phone support agent workflow example
goosewin May 26, 2025
4769ff0
feat: update navigation to link new customer support hotline example
goosewin May 26, 2025
44ab9ad
feat: add screenshots for customer support hotline example
goosewin May 26, 2025
a6c90a6
fix: customer support hotline intro paragraph
goosewin May 26, 2025
e7f9bf0
fix(customer-support-hotline): image URLs
goosewin May 26, 2025
e9ad9e1
fix(customer-support-hotline): remove broken link from outro
goosewin May 26, 2025
6a69671
chore (customer-support-hotline): refine copy, add videos
goosewin May 26, 2025
07ced34
chore(customer-support-hotline): delete unnecessary screenshots
goosewin May 26, 2025
d9f31a0
fix(customer-support-hotline): slug
goosewin May 26, 2025
568958d
feat(appointment-scheduling): initial commit
goosewin May 26, 2025
69221a1
feat(banking-customer-support): update example to cover a banking use…
goosewin May 26, 2025
77aaefd
Merge branch 'main' into feature/customer-support-hotline-example
goosewin May 26, 2025
721c0b3
chore(inbound-support): address review feedback, fix system prompt
goosewin May 26, 2025
b1afd64
Merge branch 'feature/customer-support-hotline-example' into feature/…
goosewin May 26, 2025
35d4096
feat(appointment-scheduling): new workflow example
goosewin May 28, 2025
20676bc
feat(clinic-triage-scheduling): new workflow example
goosewin May 28, 2025
99d9ed0
feat(ecommerce-order-management): new workflow example
goosewin May 28, 2025
35e858b
feat(outbound-sales): new workflow example
goosewin May 28, 2025
cffa8e6
chore: delete pizza example
goosewin May 28, 2025
d87d303
fix: broken video URLs
goosewin May 28, 2025
75b3387
chore: update navigation to include new workflow examples
goosewin May 28, 2025
aa45fae
fix(inbound-support): broken video URL
goosewin May 28, 2025
6515261
chore: update `overview.mdx` to display new examples
goosewin May 28, 2025
40ac27a
feat(call-forwarding): update doc to incentivize use of dashboard
goosewin May 28, 2025
f77e415
feat(using-query-tool): update doc to incentivize use of dashboard
goosewin May 28, 2025
11a6198
feat(custom-tools): update doc to incentivize use of dashboard
goosewin May 28, 2025
6f43a80
Merge branch 'main' into feature/workflow-examples
goosewin May 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions fern/call-forwarding.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,21 @@ Vapi's call forwarding functionality allows you to redirect calls to different p

## Setting Up Call Forwarding

### 1. Defining Destinations and Messages
### 1. Create a Transfer Call Tool in the Dashboard

The `transferCall` tool includes a list of destinations and corresponding messages to notify the caller:
The recommended approach is to create your transfer call tool in the Vapi dashboard:

1. Navigate to **Tools** in your Vapi dashboard
2. Click **Create Tool**
3. Select **Transfer Call** as the tool type
4. Configure your destinations:
- **Department A**: `+1234567890` with message "I am forwarding your call to Department A. Please stay on the line."
- **Department B**: `+0987654321` with message "I am forwarding your call to Department B. Please stay on the line."
- **Department C**: `+1122334455` with message "I am forwarding your call to Department C. Please stay on the line."

### 2. Alternative: API Configuration

You can also define the tool via API with destinations and corresponding messages:

```json
{
Expand Down Expand Up @@ -112,7 +124,7 @@ You can also specify the `extension` parameter to forward the call to an extensi
]
```

### 2. Using the `transferCall` Function
### 3. Using the `transferCall` Function

When the assistant needs to forward a call, it uses the `transferCall` function with the appropriate destination:

Expand All @@ -127,7 +139,7 @@ When the assistant needs to forward a call, it uses the `transferCall` function
}
```

### 3. Customizing Messages
### 4. Customizing Messages

Customize the messages for each destination to provide clear information to the caller:

Expand Down
16 changes: 12 additions & 4 deletions fern/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,18 @@ navigation:
- page: Inbound support
path: examples/inbound-support.mdx
icon: fa-light fa-phone-volume
- page: Appointment scheduling
path: examples/appointment-scheduling.mdx
icon: fa-light fa-calendar-check
- page: Outbound sales
path: examples/outbound-sales.mdx
icon: fa-light fa-money-bill-wave
- page: Pizza website
path: examples/pizza-website.mdx
icon: fa-light fa-pizza-slice
- page: Medical triage
path: examples/clinic-triage-scheduling.mdx
icon: fa-light fa-stethoscope
- page: Order management
path: examples/ecommerce-order-management.mdx
icon: fa-light fa-shopping-cart
- page: Voice widget
path: examples/voice-widget.mdx
icon: fa-light fa-window-maximize
Expand Down Expand Up @@ -719,7 +725,9 @@ redirects:
- source: "/technical_support"
destination: "/examples/inbound-support"
- source: "/pizza_website"
destination: "/examples/pizza-website"
destination: "/examples/inbound-support"
- source: "/examples/pizza-website"
destination: "/examples/inbound-support"
- source: "/outbound_call_python"
destination: "/examples/outbound-call-python"
- source: "/voice_widget"
Expand Down
266 changes: 266 additions & 0 deletions fern/examples/appointment-scheduling.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
---
title: Appointment scheduling workflow
subtitle: Build an AI receptionist workflow that schedules, reschedules, and cancels appointments using visual nodes.
slug: examples/appointment-scheduling
description: Build a voice AI appointment scheduling workflow with calendar integration, availability checking, and automated confirmations using Vapi's workflow builder.
---

## Overview

Build an AI-powered appointment scheduling workflow that handles inbound calls for booking, rescheduling, and canceling appointments. The workflow uses visual nodes to create branching logic, integrates with calendar systems, checks availability in real-time, and sends confirmation messages.

**What You'll Build:**
* Visual workflow with branching appointment logic
* Real-time calendar integration and availability checking
* Customer database with automated confirmations
* Global nodes for error handling and validation
* 24/7 phone booking with conditional routing

## Prerequisites

* A [Vapi account](https://dashboard.vapi.ai/).
* A Google Calendar account (or other calendar service).

## Scenario

We will be creating an appointment scheduling workflow for Tony's Barbershop, a traditional barbershop that wants to automate their phone booking process with sophisticated branching logic to handle different appointment scenarios.

---

## 1. Create a Knowledge Base

<Steps>
<Step title="Download the spreadsheets">
<div className="flex gap-2">
<Download src="../static/spreadsheets/appointment-scheduling/services.csv">
<Button intent="primary">Download services.csv</Button>
</Download>
<Download src="../static/spreadsheets/appointment-scheduling/customers.csv">
<Button intent="primary">Download customers.csv</Button>
</Download>
<Download src="../static/spreadsheets/appointment-scheduling/appointments.csv">
<Button intent="primary">Download appointments.csv</Button>
</Download>
</div>
</Step>
<Step title="Navigate to the Files section">
In your Vapi dashboard, click `Files` in the left sidebar.
</Step>
<Step title="Upload the spreadsheets">
- Click `Choose file`. Upload all three CSV files: `services.csv`, `customers.csv`, and `appointments.csv`.
- Note the file IDs. We'll need them later to create tools.
</Step>
</Steps>

<video autoPlay loop muted src="../static/videos/upload-files.mp4" type="video/mp4" style={{ aspectRatio: '16 / 9', width: '100%' }} />

---

## 2. Create a Workflow

<Steps>
<Step title="Open the Vapi Dashboard">
Go to [dashboard.vapi.ai](https://dashboard.vapi.ai) and log in to your account.
</Step>
<Step title="Navigate to the Workflows section">
Click `Workflows` in the left sidebar.
</Step>
<Step title="Create a new workflow">
- Click `Create Workflow`.
- Enter workflow name: `Barbershop Appointment Workflow`.
- Select the default template (includes Call Start node).
- Click "Create Workflow".
</Step>
<Step title="Configure Workflow Settings">
- Configure workflow variables for customer data and appointment information
</Step>
</Steps>

<video autoPlay loop muted src="../static/videos/create-workflow.mp4" type="video/mp4" style={{ aspectRatio: '16 / 9', width: '100%' }} />

---

## 3. Build the Workflow

You'll start with a default template that includes a "Call Start" node. We'll modify the existing nodes and add new ones to create our appointment scheduling workflow.

<Steps>
<Step title="Configure the Initial Conversation Node">
The default template includes a conversation node. Click on it and configure:

**First Message**:
```txt
Hello! Thank you for calling Tony's Barbershop. This is Sarah, your booking assistant. I can help you schedule, reschedule, or cancel appointments. How can I help you today?
```

**Prompt**:
```txt
You are Sarah, the friendly booking assistant for Tony's Barbershop.

Listen to the customer's response and determine their intent:
- "schedule" for new appointments
- "reschedule" for changing existing appointments
- "cancel" for canceling appointments
- "status" for checking appointment details
- "other" for anything else

Keep responses under 35 words. Ask clarifying questions if intent is unclear.
```

**Extract Variables**:
- Variable: `intent`
- Type: `String`
- Description: `The customer's primary intent`
- Enum Values: `schedule`, `reschedule`, `cancel`, `status`, `other`
</Step>

<Step title="Add Customer Verification Node">
Click the + button below the greeting node and add a new **Conversation** node:

**Prompt**:
```txt
Now I need to verify your information. Can you please provide your phone number or full name so I can look up your account?

If they provide a phone number, extract it. If they provide a name, extract it.
Be friendly and reassuring about privacy.
```

**Extract Variables**:
- Variable: `phone_number`
- Type: `String`
- Description: `Customer's phone number if provided`
- Variable: `customer_name`
- Type: `String`
- Description: `Customer's full name if provided`
</Step>

<Step title="Add Customer Lookup Tool Node">
Add a **Tool** node:

**Select Tool**: Choose your pre-configured customer lookup tool from the dropdown. This tool will use the extracted `phone_number` and `customer_name` variables to find the customer in your database.
</Step>

<Step title="Add Intent Routing Logic">
Create branching paths based on the customer's intent. Add multiple conversation nodes:

**Schedule New Appointment Node**:
- **Prompt**: `Great! I can help you schedule a new appointment. What type of service would you like? We offer haircuts, beard trims, shampoo and styling, and full grooming packages.`

**Reschedule Appointment Node**:
- **Prompt**: `I can help you reschedule your appointment. Let me first look up your current booking details.`

**Cancel Appointment Node**:
- **Prompt**: `I can help you cancel your appointment. Let me look up your current booking to confirm the details.`
</Step>

<Step title="Configure Edge Conditions">
Connect the nodes with conditional edges:

**To Schedule Appointment Node**:
- Condition: `if the user said yes` (AI condition)
- Alternative: `{{ intent == "schedule" }}` (Logic condition)

**To Reschedule Appointment Node**:
- Condition: `if the user said yes` (AI condition)
- Alternative: `{{ intent == "reschedule" }}` (Logic condition)

**To Cancel Appointment Node**:
- Condition: `if the user said yes` (AI condition)
- Alternative: `{{ intent == "cancel" }}` (Logic condition)
</Step>

<Step title="Add Global Error Handling Node">
Create a global conversation node that checks for errors after every step:

**Enable Global Node**: Toggle this on to make the node available from any point in the conversation

**Prompt**:
```txt
I apologize for any confusion. Let me transfer you to one of our human staff members who can better assist you. Please hold for just a moment.
```

This global node will activate whenever there's an error or the customer becomes frustrated, regardless of where they are in the workflow.
</Step>

<Step title="Add Availability Checking Flow">
For the schedule appointment flow, add these nodes:

**Service Selection Node** (Conversation):
- **Prompt**: `What type of service would you like to book? Also, do you have a preferred date and time?`
- **Extract Variables**: `service_type`, `preferred_date`, `preferred_time`

**Availability Check Tool Node**:
- **Select Tool**: Choose "Check Availability" from the pre-defined calendar tools
- This will automatically check available slots based on the extracted preferences

**Availability Results Node** (Conversation):
- **Prompt**: `Based on your preferences, here are the available time slots. Which one works best for you?`
- Use conditional logic to offer alternatives if preferred time unavailable
</Step>

<Step title="Add Confirmation and Booking Flow">
**Booking Confirmation Node** (Conversation):
- **Prompt**: `Perfect! Let me confirm your appointment details: [service] on [date] at [time]. Is this correct?`
- **Extract Variables**: `confirmation_status`

**Create Appointment Tool Node**:
- **Select Tool**: Choose "Schedule Event" from the pre-defined calendar tools
- This will book the appointment in your calendar system

**Send Confirmation Node** (Tool):
- **Select Tool**: Choose your pre-configured SMS/email confirmation tool

**Completion Node** (Conversation):
- **Prompt**: `Great! Your appointment is confirmed. You'll receive a confirmation message shortly. Is there anything else I can help you with today?`
</Step>

<Step title="Add Transfer and Hangup Options">
**Transfer to Human Node**:
- **Node Type**: `Transfer Call`
- **Phone to transfer to**: `+1-555-BARBER-1` (your barbershop number)

**End Call Node**:
- **Node Type**: `End Call`
- **First Message**: `Thank you for calling Tony's Barbershop. Have a great day!`
- Use when customer is satisfied and no further assistance needed
</Step>
</Steps>

---

## 4. Configure Phone Number

<Steps>
<Step title="Navigate to Phone Numbers">
Click `Phone Numbers` in the left sidebar of your dashboard.
</Step>
<Step title="Create or Import Phone Number">
- Click `Create Phone Number` for a new Vapi number, or
- Click `Import Phone Number` to use your existing number from Twilio/Telnyx
</Step>
<Step title="Configure Inbound Settings">
**Workflow**: Select your `Barbershop Appointment Workflow`

**Advanced Settings**:
- Enable call recording for quality assurance
- Set maximum call duration (e.g., 15 minutes)
- Configure voicemail detection if needed
</Step>
<Step title="Test Your Phone Number">
Call your Vapi phone number to test the complete workflow:
- Test different appointment scenarios
- Verify branching logic works correctly
- Ensure global nodes trigger appropriately
- Test error handling and recovery flows
</Step>
</Steps>

## Next Steps

Just like that, you've built an automated appointment scheduling workflow that can handle inbound calls, manage bookings, and provide 24/7 availability for your barbershop.

Consider reading the following guides to further enhance your workflow:

* [**Custom Tools**](/tools/custom-tools) - Create custom tools for calendar integration and customer management.
* [**Voice Formatting Plan**](/assistants/voice-formatting-plan) - Configure speech formatting for clear appointment communication.
* [**Dynamic Variables**](/assistants/dynamic-variables) - Use variables to personalize appointment confirmations.
Loading
Loading