Okay, let's break down how to get started integrating Calendry into your chatbot/agent/RAG app. Here's a comprehensive guide, covering the key steps, considerations, and resources. I'll organize it into sections: 1. Understanding Calendry & Its API, 2. Setup & Authentication, 3. Core Integration Steps, 4. Handling Responses, 5. Advanced Considerations, 6. Resources & Examples.
1. Understanding Calendry & Its API
What is Calendry? Calendry is a scheduling API that lets users book meetings directly within your application without leaving the conversation. It handles complex scheduling logic (time zone conversions, availability checks, etc.) for you. It's designed to be integrated into conversational interfaces.
Key Features:
Availability Retrieval: Finds available time slots based on your criteria (duration, team members, etc.).
Meeting Creation: Books meetings directly into connected calendars (Google Calendar, Outlook Calendar, etc.).
Webhooks: Receive real-time updates about meeting events (created, canceled, rescheduled).
Team Scheduling: Supports scheduling with multiple team members.
Customization: Allows you to customize the scheduling flow and appearance.
API Documentation: This is your bible. Start here: https://docs.calendry.com/ Familiarize yourself with the different endpoints, request/response formats, and authentication methods. Pay close attention to the "Tool Call" section, as that's what you'll likely be using with modern LLMs.
2. Setup & Authentication
Create a Calendry Account: Sign up for a Calendry account at https://calendry.com/. They have a free tier for testing.
API Key: Once you have an account, generate an API key. Treat this key like a password! Do not hardcode it directly into your application code. Use environment variables (see "Advanced Considerations" below).
Connect Calendars: Connect the calendars you want to use for scheduling (Google Calendar, Outlook, etc.). Calendry needs access to these calendars to check availability and book meetings. This is done through the Calendry dashboard.
Team Members (Optional): If you're scheduling with a team, add your team members to Calendry and link their calendars.
Tool Definition (Crucial for LLMs): Calendry provides a JSON schema for defining the tool call. This is what you'll feed to your LLM (like GPT-4, Gemini, etc.) to tell it how to interact with Calendry. You can find the latest schema here: https://docs.calendry.com/reference/tool-call This schema defines the input parameters (e.g., date, duration, attendees) and the expected output format.
3. Core Integration Steps (Using Tool Calls with an LLM)
This assumes you're using an LLM like GPT-4 or Gemini, which supports tool calls. The process is similar for other LLMs, but the specific API calls will differ.
User Input: Your chatbot receives a user request to schedule a meeting (e.g., "Schedule a meeting with John next Tuesday for 30 minutes").
LLM Prompt: You construct a prompt for your LLM that includes:
System Message: Explain to the LLM that it has access to a Calendry tool for scheduling meetings. Include the Calendry tool schema (the JSON definition from step 2).
User Message: The user's scheduling request.
Example:
code
System: You have access to the following tool:
{
"type": "function",
"function": {
"name": "calendry_schedule_meeting",
"description": "Schedules a meeting using Calendry.",
"parameters": {
"type": "object",
"properties": {
"date": {
"type": "string",
"description": "The date for the meeting (YYYY-MM-DD)."
},
"duration": {
"type": "integer",
"description": "The duration of the meeting in minutes."
},
"attendees": {
"type": "array",
"items": {
"type": "string"
},
"description": "An array of email addresses of the attendees."
},
"time_zone": {
"type": "string",
"description": "The time zone for the meeting (e.g., America/Los_Angeles)."
}
},
"required": ["date", "duration", "attendees"]
}
}
}
User: Schedule a meeting with john.doe@example.com next Tuesday for 30 minutes.
LLM Response: The LLM analyzes the user request and, if it determines a scheduling action is needed, it will generate a JSON object representing a tool call. This JSON will conform to the Calendry tool schema. For example:
json
4. Handling Responses
Success: If the meeting was scheduled successfully, format a response for the user that includes the meeting details (date, time, attendees, meeting URL). Send this response back to the user through your chatbot.
Failure: If the meeting could not be scheduled (e.g., no available time slots, invalid parameters), format an informative error message for the user. Explain the reason for the failure and suggest possible solutions (e.g., "No available time slots on that day. Would you like to try a different date?").
LLM Feedback: Crucially, send the result of the Calendry API call (success or failure, and any error messages) back to the LLM. This allows the LLM to learn from its mistakes and improve its scheduling accuracy. Include the Calendry response in the next prompt to the LLM. For example:
code
System: You have access to the Calendry tool...
User: Schedule a meeting with john.doe@example.com next Tuesday for 30 minutes.
Assistant:
{
"tool_call": { ... }
}
User: (Calendry API Response) {"meeting_id": "12345", "meeting_url": "https://...", "status": "success"}
Assistant: Great! I've scheduled a meeting with john.doe@example.com for next Tuesday at [time] at [meeting_url].
5. Advanced Considerations
Error Handling: Implement robust error handling to gracefully handle API errors, invalid user input, and unexpected situations.
Environment Variables: Store your Calendry API key in an environment variable instead of hardcoding it in your code. This is essential for security.
Time Zones: Pay careful attention to time zones. Calendry handles time zone conversions, but you need to ensure that the user's time zone is correctly identified and passed to the API.
User Authentication: If you're scheduling meetings on behalf of users, you'll need to implement user authentication to securely access their calendars. Calendry supports OAuth 2.0 for authentication.
Webhooks: Use Calendry webhooks to receive real-time updates about meeting events (created, canceled, rescheduled). This allows you to keep your chatbot's state synchronized with the user's calendar.
RAG Integration: If you're using a RAG (Retrieval-Augmented Generation) system, you can use the retrieved context to provide more relevant scheduling suggestions. For example, if the user is discussing a specific project, you can suggest scheduling a meeting to discuss that project.
State Management: Keep track of the conversation state to handle multi-turn scheduling flows. For example, if the user initially asks to schedule a meeting but doesn't provide a date, you need to prompt them for the date in a subsequent turn.
Rate Limits: Be aware of Calendry's API rate limits and implement appropriate throttling mechanisms to avoid exceeding them.
Execute the Tool Call: Your application code intercepts the tool call from the LLM. You extract the parameters (date, duration, attendees) from the JSON.
Call the Calendry API: Using the extracted parameters, you make a request to the Calendry API's /meetings endpoint (or the appropriate endpoint for scheduling). You'll need to include your Calendry API key in the request headers.
Calendry Response: Calendry processes the request and returns a response. This response will typically include:
Meeting ID: A unique identifier for the scheduled meeting.
Meeting URL: A link to the meeting in the connected calendar.
Status: Indicates whether the meeting was scheduled successfully.