[Productivity Enhancement] Auto-Scheduling Conference Rooms and Office Equipment: Building a Smart Booking Engine with the Google Calendar API
The Wasted Time Hidden in "Booking and Managing" Conference Rooms and Office Equipment
Many companies manage the booking of shared resources—such as conference rooms, rental laptops, and company vehicles—using Google Calendar. However, do you frequently encounter inefficient situations like the following?
- Double Bookings: Multiple people trying to book the same conference room simultaneously during schedule adjustments, resulting in conflicts.
- Forgotten Bookings and Wasted Rooms (Ghost Rooms): Although a meeting is canceled, the reservation is not deleted from Google Calendar, leaving the unused room marked as "booked."
- The Hassle of Opening the Calendar Screen: Having to deliberately open a separate Google Calendar window to check availability and make a reservation while coordinating appointments with external clients or chatting internally.
These issues can be completely resolved by building an auto-scheduling bot that integrates your chat tool (e.g., Email (Resend), Email (Resend)) with the Google Calendar API. Triggered by conversations or button clicks in the chat, the API scans resource availability in real-time and instantly locks in the reservation.
2. Before & After: Resolving the Bottleneck
| Item | Manual Booking & Scheduling (Before) | API Auto-Integration Bot (After) |
|---|---|---|
| Booking Effort | Opening Google Calendar for manual entry | Completed simply by typing /book RoomA 14:00 in chat |
| Double Bookings | Risk of overwrite conflicts during concurrent edits | Completely blocks overlaps via API conflict checking |
| Ghost Booking Prevention | Chronic failure to delete reservations upon cancellation | Automatically releases the room if the "start" button isn't pressed at the scheduled time |
| Schedule Coordination | Manual effort comparing calendars to find free time | API searches everyone's availability and auto-proposes optimal times |
3. Implementation Example: Checking Room Availability and Auto-Booking via Google Calendar API
Below is a TypeScript code example that uses a service account to check the free time of a specific resource (conference room) in Google Calendar, automatically booking it if available.
import { google } from "googleapis";
const SCOPES = ["https://www.googleapis.com/auth/calendar"];
const auth = new google.auth.GoogleAuth({
credentials: {
client_email: process.env.GOOGLE_CLIENT_EMAIL,
private_key: process.env.GOOGLE_PRIVATE_KEY?.replace(/\\n/g, "\n"),
},
scopes: SCOPES,
});
const calendar = google.calendar({ version: "v3", auth });
export async function checkAndBookResource(
calendarId: string, // Resource Calendar ID for the conference room
startTime: string, // ISO8601 Format
endTime: string, // ISO8601 Format
summary: string
) {
try {
// 1. Scan the availability (Free/Busy) for the specified time
const checkResponse = await calendar.freebusy.query({
requestBody: {
timeMin: startTime,
timeMax: endTime,
items: [{ id: calendarId }],
},
});
const busyTimes = checkResponse.data.calendars?.[calendarId]?.busy || [];
if (busyTimes.length > 0) {
console.log("Resource is busy during the requested time slot.");
return { success: false, message: "The requested time slot is already booked." };
}
// 2. Register a new event (booking) if available
const eventResponse = await calendar.events.insert({
calendarId,
requestBody: {
summary: summary,
start: { dateTime: startTime, timeZone: "Asia/Tokyo" },
end: { dateTime: endTime, timeZone: "Asia/Tokyo" },
},
});
console.log(`Event created: ${eventResponse.data.id}`);
return {
success: true,
eventId: eventResponse.data.id,
link: eventResponse.data.htmlLink,
};
} catch (error) {
console.error("Calendar automation failed:", error);
throw error;
}
}
4. HadayaLab's Internal BPR & Knowledge Integration
At HadayaLab, we support the construction of smart office environments where daily wasteful coordination time is reduced, allowing members to focus on their primary tasks.
- Building Chat Integration Bots: Developing custom commands to seamlessly generate URLs for Google Calendar, Zoom, and Google Meet from Email (Resend) or Email (Resend).
- Resource Management Dashboards: Visualizing conference room utilization rates and office equipment operating statuses, contributing to the reduction of wasted office costs.
- Google Workspace API Consulting: Outsourcing the application of company-wide automation and policies, such as account management and email forwarding rules.
If you are an office manager who wants to "make internal calendar coordination and conference room bookings smoother," please consult HadayaLab for our Smart BPR plans.