|
| 1 | +--- |
| 2 | +title: Google Calendar Integration |
| 3 | +subtitle: 'Connect your assistant to Google Calendar for seamless appointment scheduling.' |
| 4 | +slug: tools/google-calendar |
| 5 | +--- |
| 6 | + |
| 7 | +The Google Calendar integration allows your Vapi assistant to create calendar events through voice commands. This enables your assistant to schedule appointments, meetings, and other calendar events directly during phone calls. |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +Before you can use the Google Calendar integration, you need to: |
| 12 | +1. Have a Google Calendar account |
| 13 | +2. Have access to the Vapi Dashboard |
| 14 | +3. Have an assistant created in Vapi |
| 15 | + |
| 16 | +## Setup Steps |
| 17 | + |
| 18 | +### 1. Connect Google Calendar Account |
| 19 | + |
| 20 | +First, you need to connect your Google Calendar account to Vapi: |
| 21 | + |
| 22 | +1. Navigate to the Vapi Dashboard |
| 23 | +2. Go to **Providers Keys** > **Tools Provider** > **Google Calendar** |
| 24 | +3. Click the **Connect** button |
| 25 | +4. A Google authorization popup will appear |
| 26 | +5. Follow the prompts to authorize Vapi to access your Google Calendar |
| 27 | + |
| 28 | +<Note> |
| 29 | + The authorization process will request access to your Google Calendar to create and manage events. |
| 30 | +</Note> |
| 31 | + |
| 32 | +<Frame caption="Connect Google Calendar"> |
| 33 | + <img |
| 34 | + src="../static/images/tools/google-calendar-connect.png" |
| 35 | + alt="Select files from your Assistant" |
| 36 | + /> |
| 37 | +</Frame> |
| 38 | + |
| 39 | +### 2. Create Calendar Tool |
| 40 | + |
| 41 | +After connecting your Google Calendar account, create a new tool: |
| 42 | + |
| 43 | +1. Go to **Dashboard** > **Tools** page |
| 44 | +2. Click the **Create Tool** button |
| 45 | +3. Select **Google Calendar** from the available options |
| 46 | +4. Provide a name for your tool |
| 47 | +5. Add a description explaining when this tool should be invoked (e.g., "Use this tool when the user wants to schedule an appointment or create a calendar event") |
| 48 | + |
| 49 | +<Note> |
| 50 | + The description field is crucial as it helps the AI model understand when and how to use the tool. Be specific about the scenarios and conditions when the tool should be invoked. |
| 51 | +</Note> |
| 52 | + |
| 53 | +<Frame caption="Create Calendar Tool"> |
| 54 | + <img |
| 55 | + src="../static/images/tools/create-tool-menu.png" |
| 56 | + alt="Create Calendar Tool" |
| 57 | + /> |
| 58 | + <img |
| 59 | + src="../static/images/tools/google-calendar-example.png" |
| 60 | + alt="Tool Configuration" |
| 61 | + /> |
| 62 | +</Frame> |
| 63 | + |
| 64 | +### 3. Add Tool to Assistant |
| 65 | + |
| 66 | +Now, add the calendar tool to your assistant: |
| 67 | + |
| 68 | +1. Navigate to **Dashboard** > **Assistants** page |
| 69 | +2. Select your assistant |
| 70 | +3. Go to the **Functions** tab |
| 71 | +4. In the tools dropdown, select your newly created calendar tool |
| 72 | +5. Click **Publish** to save your changes |
| 73 | + |
| 74 | +<Frame caption="Add Tool to Assistant"> |
| 75 | + <img |
| 76 | + src="../static/images/tools/assistant-select-google-calendar-tool.png" |
| 77 | + alt="Add Tool to Assistant" |
| 78 | + /> |
| 79 | +</Frame> |
| 80 | + |
| 81 | +## Tool Configuration |
| 82 | + |
| 83 | +The Google Calendar tool uses the following fields to create events: |
| 84 | + |
| 85 | +- `summary`: The title or description of the calendar event |
| 86 | +- `startDateTime`: The start date and time of the event |
| 87 | +- `endDateTime`: The end date and time of the event |
| 88 | +- `timeZone`: The timezone for the event |
| 89 | + |
| 90 | +<Info> |
| 91 | + All datetime fields should be provided in ISO 8601 format. |
| 92 | +</Info> |
| 93 | + |
| 94 | +## Example Usage |
| 95 | + |
| 96 | +Here's how the tool can be used in your assistant's configuration: |
| 97 | + |
| 98 | +```json |
| 99 | +{ |
| 100 | + "model": { |
| 101 | + "provider": "openai", |
| 102 | + "model": "gpt-4o", |
| 103 | + "messages": [ |
| 104 | + { |
| 105 | + "role": "system", |
| 106 | + "content": "You are a scheduling assistant. When users want to schedule an appointment, use the Google Calendar tool to create the event." |
| 107 | + } |
| 108 | + ], |
| 109 | + "tools": [ |
| 110 | + { |
| 111 | + "type": "google.calendar.event.create", |
| 112 | + "name": "scheduleAppointment", |
| 113 | + "description": "Use this tool to schedule appointments and create calendar events" |
| 114 | + } |
| 115 | + ] |
| 116 | + } |
| 117 | +} |
| 118 | +``` |
| 119 | + |
| 120 | +## Best Practices |
| 121 | + |
| 122 | +1. **Clear Instructions**: Provide clear instructions in your assistant's system message about when to use the calendar tool |
| 123 | +2. **Error Handling**: Include fallback responses for cases where the calendar tool fails |
| 124 | +3. **Time Zone Awareness**: Always specify the correct timezone for events |
| 125 | +4. **Event Details**: Ensure all required fields are properly filled when creating events |
| 126 | + |
| 127 | +<CardGroup cols={2}> |
| 128 | + <Card |
| 129 | + title="Need Help?" |
| 130 | + icon="question-circle" |
| 131 | + href="https://discord.gg/pUFNcf2WmH" |
| 132 | + > |
| 133 | + Join our Discord community for support with Google Calendar integration |
| 134 | + </Card> |
| 135 | + <Card |
| 136 | + title="API Reference" |
| 137 | + icon="book" |
| 138 | + href="/api-reference/tools/create" |
| 139 | + > |
| 140 | + View the complete API documentation for tools |
| 141 | + </Card> |
| 142 | +</CardGroup> |
0 commit comments