Build a Google Calendar Booking Agent
Build an AI-powered booking agent that automatically schedules meetings using OpenAI's Agent Builder and Pica MCP Server
Video Tutorial
Overview
Scheduling meetings is a time-consuming task that involves:
- Back-and-forth emails to find availability
- Manually checking calendars to avoid conflicts
- Creating calendar events and sending invitations
- Confirming details with all participants
What if you could automate all of this with an AI agent?
With OpenAI's Agent Builder and Pica, you can build an intelligent booking agent that handles meeting scheduling automatically.
What You'll Build
An AI booking agent that:
- 🤖 Greets users and collects meeting requirements
- 📅 Checks your Google Calendar for availability using Pica
- ⏰ Suggests available time slots based on preferences
- ✉️ Creates calendar events with guest invitations
- ✅ Confirms bookings with the user
All with natural language conversations!
Prerequisites
Before starting, make sure you have:
- An OpenAI account with access to Agent Builder
- A Pica account (sign up here)
Part 1: Build the Agent in OpenAI Agent Builder
Step 1: Create a New Agent
Navigate to OpenAI's Agent Builder and create a new agent.
Click + New Agent to get started.
Step 2: Configure the Agent Node
Add an Agent node to your workflow and configure it with the following system prompt:
You are a helpful meeting scheduling assistant with access to my Google Calendar via Pica. Your job is to find an available time on my calendar to schedule a meeting with the user.
Meeting times are 30 minutes.
Instructions:
1. Greet the user and let them know you're here to help schedule a meeting.
2. Ask the user for:
- Their full name
- Their email address
- Any preferred date/time range (if they have one)
3. Check my Google Calendar via Pica for available times that fit their preferences.
4. Suggest available meeting time options to the user (or choose the earliest suitable time if they don't specify).
5. Once confirmed, create the event in my calendar and include the user's name and email as a guest.
6. Confirm with the user that the meeting has been scheduled.
Be polite, efficient, and clear throughout the process.
Tip: Copy the prompt above and paste it into your Agent node's system prompt field. This gives your agent clear instructions on how to handle the booking flow.
Step 3: Add the Pica MCP Server
Click + New Tools → MCP Server → + Server
Configure the MCP server with these settings:
URL:
https://mcp.picaos.com/mcp
Label:
pica_mcp_server
Authentication:
Custom Headers
For the Header Value, you'll need your Pica Secret Key:
- Visit Pica API Keys
- Copy your secret key
- Add it as a custom header:
x-pica-secret: YOUR_SECRET_KEY
⚠️ Warning: Keep your Pica secret key secure! Never commit it to version control or share it publicly.
Step 4: Connect Google Calendar
Your agent needs access to Google Calendar:
- Go to Pica Dashboard Connections
- Click + Add Connection
- Select Google Calendar
- Authorize Pica to access your calendar
Step 5: Publish Your Agent
Once everything is configured:
- Test your agent using the preview panel on the right
- Click Publish in the top-right corner
- Copy the Workflow ID that appears after publishing
You'll need this Workflow ID for the next part!
Part 2: Build the ChatKit Interface
Now let's create a beautiful chat interface for your booking agent using OpenAI's ChatKit.
Step 1: Clone the ChatKit Starter App
git clone https://github.com/openai/openai-chatkit-starter-app.git
cd openai-chatkit-starter-app
Step 2: Install Dependencies
npm install
Step 3: Configure Environment Variables
Create a .env.local
file in the root directory:
OPENAI_API_KEY=your_openai_api_key
NEXT_PUBLIC_CHATKIT_WORKFLOW_ID=your_workflow_id
Where do I find these values?
OPENAI_API_KEY:
- Go to OpenAI API Keys
- Create a new key within the same org & project as your Agent Builder
NEXT_PUBLIC_CHATKIT_WORKFLOW_ID:
- This is the Workflow ID you copied after publishing your agent
- It should look something like:
wf_abc123xyz
Step 4: Run the Application
npm run dev
Open http://localhost:3000 in your browser.
Step 5: Test Your Booking Agent
Try starting a conversation:
- "I'd like to schedule a meeting"
- "Can you help me book a 30-minute call?"
- "I want to meet tomorrow afternoon"
Your agent should:
- Greet you warmly
- Ask for your details
- Check your calendar for availability
- Suggest time slots
- Create the meeting when confirmed
Extend the Agent
You can enhance your booking agent by:
- Adding timezone support for international meetings
- Integrating Gmail to send custom confirmation emails
- Checking multiple calendars for team availability
- Adding meeting types (15min, 30min, 60min calls)
- Collecting meeting agendas before scheduling
Connect More Services
Pica supports 150+ integrations through the MCP server. Add more tools to your agent:
- Slack - Send meeting notifications
- Notion - Create meeting notes pages
- Zoom - Generate video meeting links
- Linear - Create follow-up tasks
Visit the Pica Dashboard to explore available connections.
Troubleshooting
Agent isn't connecting to calendar
Make sure:
- Your Google Calendar connection is active in Pica Dashboard
- The
x-pica-secret
header is correctly set in Agent Builder - You've published the agent after making changes
ChatKit won't load the workflow
Verify:
-
NEXT_PUBLIC_CHATKIT_WORKFLOW_ID
matches your published workflow ID -
OPENAI_API_KEY
is from the same org/project as Agent Builder - The workflow is published (not just saved as draft)
Calendar events aren't being created
Check:
- The agent has permission to write to your calendar
- You confirmed the time slot in the conversation
- The guest email address is valid
Resources
- OpenAI Agent Builder Documentation - Learn how to create, configure, and deploy agents using OpenAI's Agent Builder.
- ChatKit JavaScript Library - Integrate conversational AI into your app with the official ChatKit JS library.
- Pica MCP Server - Access the Pica MCP Server for seamless integration with 150+ SaaS tools.
- Pica API Reference - Explore the full API documentation for Pica's endpoints and capabilities.
Top comments (0)