- Published on
- Abinyah Walker
How I Built a Google Calendar Chatbot with ReTool AI and OpenAI
How I Built a Google Calendar Chatbot with ReTool AI and OpenAI
Integrating ReTool AI, Google Calendar, and the OpenAI API to unlock a new powerful way to interact with a calendars. I will discuss how I built and connected queries and automations to allow my chatbot app to read, create, and update my work calendar.
What You’ll Need
ReTool AI (or ReTool with AI blocks)
Google Calendar API access (OAuth2 enabled)
OpenAI API key (ChatGPT model or GPT-4)
A connected Google Workspace account
Step 1: Connect ReTool to Google Calendar
Start by setting up your Google Calendar as a Resource in ReTool:
Go to Resources > Create new.
Choose REST API.
Input the base URL: https://www.googleapis.com/calendar/v3/
Set up OAuth2 authentication:
Auth type: OAuth2
Authorization URL: https://accounts.google.com/o/oauth2/auth
Token URL: https://oauth2.googleapis.com/token
Scope: https://www.googleapis.com/auth/calendar
Add client ID, secret, and redirect URI from your Google Cloud Console.
Step 2: Build the Read Query in ReTool
Once authenticated, test it by creating a simple GET query to fetch your upcoming events.
Be sure to set the calendarId. I used "primary" to indicate my default calendar.
GET /calendars/primary/events
Set your query params:
timeMin: {{ new Date().toISOString() }}
maxResults: 10
singleEvents: true
orderBy: startTime
Map the response to display upcoming meetings in a table or pass them directly into your chatbot logic. I mapped mine to a Table so that I could see what results were being passed to my chatbot.
Step 3: Integrate OpenAI for Natural Language Understanding
Now, connect OpenAI to handle user input:
Add a JavaScript query in ReTool that sends user prompts to the OpenAI API.
Here I used input text from a component chatTextInpur.value to build my dynamic query, and passed data from the Calendar query queryCalendarEvents.date for the agent to reference.Use the response to determine if the user wants to read, create, or update a calendar event.
Parse the intent and pass it to the correct query.
Concept API call:
POST https://api.openai.com/v1/chat/completions
Headers:
Authorization: Bearer YOUR_API_KEY
Body:
{
model: "gpt-4",
messages: [
{ role: "system", content: "You're a helpful assistant that manages calendar events." },
{ role: "user", content: "What's on my calendar this afternoon?" }
]
}Step 4: Add Create and Update Queries
To Create an Event
Let the OpenAI response format the time, title, and date, then send it to this query.
POST /calendars/primary/events
Body:
{
"summary": "Team Sync",
"start": {
"dateTime": "2025-07-13T14:00:00-07:00"
},
"end": {
"dateTime": "2025-07-13T14:30:00-07:00"
}
}To Update an Event
First, find the eventId from a read query, and make sure to handle time zone formatting and input validation. then:
PUT /calendars/primary/events/{eventId}
Body:
{
"summary": "Updated Meeting Name",
"start": {
"dateTime": "2025-07-13T15:00:00-07:00"
},
"end": {
"dateTime": "2025-07-13T15:30:00-07:00"
}
}Step 5: Tie It All Together in the ReTool Chat UI
Use the AI Chat component or build a custom UI:
• User types: “Reschedule my 2 PM with Sarah to 3 PM.”
• OpenAI parses intent and extracts data.
• ReTool routes to the right query (update).
• Success/fail response is returned to the user.
Bonus: You can add history, confirmations, or even Slack-style command shortcuts (/calendar add).
Final Thoughts
With just a few components and queries I built a highly capable, low-maintenance calendar assistant. This is a good foundation for further agent enhancements with more complex/intelligent features.
It required us to setup a few things, like the ReTool interface, Google Calendar API, and OpenAI APIs for the natural language integration. Now this means we can pull our meetings, scheduling new ones, or make changes all using a chatbot. This allows us to later integrate audio, visual and meeting summaries into a more capable, simple and conversational experience.
Next Steps And New Features
Add Zoom meeting links automatically and integrate Ai summaries
Sync with multiple calendars
Add access control for team use
Want help building yours? Drop a comment or reach out.