# Cal.com Booking Source: https://docs.openmic.ai/agents/custom-functions/call-booking Learn how to add Cal.com appointment booking to your AI agents and workflows to automatically schedule meetings and calls. > [!NOTE] > > **Automated Scheduling**: The Call Booking function allows your AI agents to book appointments directly in your Cal.com calendar during conversations, streamlining the scheduling process from inquiry to confirmation. ## Interactive Demo See how to set up the Call Booking function for both simple agents and workflow agents: **Simple Agent Demo** [Add a Cal.com Booking Function to an AI Receptionist Bot](https://demo.arcade.software/m3w06Y913xeDnELya8bp?embed\&embed_mobile=tab\&embed_desktop=inline\&show_copy_link=true) **Workflow Agent Demo** [Integrate Cal.com Booking into an Automated Call Workflow](https://demo.arcade.software/9BcGG9MHKuXe9konRXiV?embed\&embed_mobile=tab\&embed_desktop=inline\&show_copy_link=true) *** ## Overview The Call Booking function integrates your Cal.com calendars with your AI agents, enabling them to book appointments automatically during conversations. This powerful feature completes the scheduling process by not just checking availability, but actually creating confirmed bookings. **Key Benefits:** * Book appointments automatically during conversations * Eliminate back-and-forth scheduling coordination * Reduce no-shows with instant calendar confirmations * Seamlessly integrate with your existing Cal.com setup **Integration:** This function uses [Cal.com](https://cal.com), a popular open-source scheduling platform. > [!NOTE] > > **Prerequisites**: You need a Cal.com account to use this function. Sign up at [cal.com](https://cal.com) if you haven't already. *** ## Setup Instructions **Simple Agents** ## Add Call Booking to Simple Agents Follow these steps to add the Call Booking function to your AI voice agent: ### Step 1: Navigate to Simple Agents From your dashboard sidebar, click on **Simple Agents**. *** ### Step 2: Select Your Agent Click on the agent you want to configure from the list. *** ### Step 3: Open Custom Functions Tab Click on the **Custom Functions** tab in the agent configuration. *** ### Step 4: Add New Function Click the **Add Function** button to open the function selection menu. *** ### Step 5: Select Call Booking Click on **Call Booking** from the available functions. A configuration popup will appear with two setup modes. ![Choose Call Booking Function](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/call-booking/simple/choose-call-book-fn.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=3631c8b403074591b9b0b06b6b59d5b1) *** ## Configuration Modes for Simple Agents Cal.com offers two ways to connect your calendar: **Static Mode** (no API key required) and **Webhook Mode** (requires API key for more control). Choose the mode that best fits your needs. **Static Mode** ## Static Mode Configuration Static mode fetches publicly available event types using your Cal.com username or organization slug. This is the easiest way to get started and doesn't require an API key. ### Step 1: Enter Cal.com Username or Organization Slug ![Enter Username or Organization Slug](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/call-booking/simple/static/step-1.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=1431dcc10b1638a77ad03ab1ba7db44e) Enter your Cal.com **username** or **organization slug**: * **Username**: Your personal Cal.com username (e.g., `jane` if your Cal.com URL is `cal.com/jane`) * Find it in your Cal.com profile settings * **Organization Slug**: Your organization's Cal.com slug (e.g., `acme` if your team URLs are like `acme.cal.com/jane` or `schedule.acme.com/jane`) * Find it in your organization settings *** ### Step 2: Fetch Event Types ![Fetch Event Types](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/call-booking/simple/static/step-2.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=425a7aae233a4f77bda8e4c6aca96edf) Click the **Fetch Event Types** button to retrieve all publicly available event types from your Cal.com account. After fetching, you'll see a dropdown list of all your available event types (e.g., "30 Minute Meeting", "Discovery Call", "Consultation"). **Choose an Event Type** from the dropdown that you want your AI agent to book appointments for. Click **Next** to continue. *** ### Step 3: Configure Function Options ![Configure Function Options](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/call-booking/simple/static/step-3.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=a1e2b51d23769d5474a88f437629de7c) Configure the following options: #### Function Name Give your function a descriptive name in snake\_case (e.g., `book_consultation`, `schedule_meeting`, `book_appointment`). #### Description Describe when this function should be used. This helps the AI understand when to book appointments. **Examples:** * "Use this when the customer wants to book a consultation appointment" * "Book this when the customer confirms they want to schedule a meeting" * "Use this to create an appointment booking in the calendar" #### Timezone (Optional) Specify the timezone for booking appointments (e.g., `America/New_York` or `Europe/London`). If not provided, Cal.com will use its default timezone (UTC). *** ### Step 4: Create Function Click **Create Function** to save your configuration. The function is now ready to use! *** ### Step 5: Test the Function Test your newly created function: 1. Start a call or conversation with your AI agent 2. Ask your agent to book an appointment, for example: * "I'd like to book an appointment for Tuesday at 2 PM" * "Can you schedule me for next Monday at 10 AM?" * "Book me for the 3 PM slot on Thursday" Your agent will use the function to create a booking in your Cal.com calendar and confirm the appointment with the customer. > [!NOTE] > > **Static mode uses public event types**, so ensure the event type you selected is set to "Public" in your Cal.com settings. **Webhook Mode** ## Webhook Mode Configuration Webhook mode provides more control and security by using your Cal.com API key. This allows you to access private event types and configure advanced settings. ### Step 1: Enter Cal.com API Key and Event Type ID ![Enter API Key and Event Type ID](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/call-booking/simple/webhook/step-1.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=69ed52480767b0ce6e952ade097998b7) You'll need two pieces of information from your Cal.com account: #### Cal.com API Key Generate an API key from your Cal.com account: 1. Log in to [Cal.com](https://app.cal.com) 2. Navigate to **Settings** → **Security** → **API Keys** 3. Click **New API Key** 4. Give it a name (e.g., "OpenMic Integration") 5. Copy the generated API key 6. Paste it in the **API Key** field > [!WARNING] > > **Keep your API key secure**: Never share your API key publicly. It provides access to your Cal.com account and calendar data. #### Cal.com Event Type ID Find your Event Type ID: 1. Go to your Cal.com dashboard 2. Click on **Event Types** 3. Open the event type you want to use 4. Look at the URL in your browser's address bar 5. The Event Type ID is the number between the slashes * Example: `app.cal.com/event-types/123456` → Event Type ID is `123456` For more details, see [Cal.com's guide on finding Event Type IDs](https://cal.com/help/event-types/eventtype-id). #### Configure Additional Fields ![Configure Additional Fields](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/call-booking/simple/webhook/step-1+.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=2d4101c3c8d64e425e3c2b575948bf85) After entering your API key and Event Type ID, you'll see additional webhook configuration options: **Call a webhook before running this tool** (Optional) * Toggle this on to validate or enrich data before booking appointments * **Use the pre-call webhook URL**: Use the webhook URL configured in your agent settings * **Custom webhook URL**: Or provide a custom webhook URL for this specific function (e.g., `https://your-domain.com/webhook/pre-tool`) Click **Next** to proceed to the function configuration. *** ### Step 2: Configure Function Options ![Configure Function Options](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/call-booking/simple/webhook/step-2.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=aefb66fb22b36be673bb3bca6931892a) Configure the following options: #### Function Name Give your function a descriptive name in snake\_case (e.g., `book_private_meeting`, `schedule_team_call`, `book_consultation`). #### Description Describe when this function should be used. This helps the AI understand when to book appointments. **Examples:** * "Use this when the customer confirms they want to book a consultation" * "Book this when someone wants to schedule a private meeting" * "Use this to create confirmed appointment bookings" *** ### Step 3: Create Function Click **Create Function** to save your configuration. The function is now ready to use! *** ### Step 4: Test the Function Test your newly created function: 1. Start a call or conversation with your AI agent 2. Ask your agent to book an appointment, for example: * "I'd like to book an appointment for Tuesday at 2 PM" * "Can you schedule me for next Monday at 10 AM?" * "Book me for the 3 PM slot on Thursday" Your agent will use the function to create a booking in your Cal.com calendar and confirm the appointment with the customer. > [!NOTE] > > **Webhook mode works with both public and private event types**, giving you more flexibility in your scheduling setup. *** ## Agent Prompt Example To help your AI agent use the booking function effectively, add clear instructions to your agent's system prompt: ``` When customers want to book an appointment and have chosen a specific time slot, use the book_appointment function to create the booking in the calendar. Always confirm the following details before booking: - Preferred date and time - Customer's name - Customer's email address - Any special requirements or notes After successfully booking, provide the customer with: - Confirmation of the booked date and time - Timezone information - Any preparation instructions or next steps Example conversation flow: Customer: "I'd like to book the Tuesday 2 PM slot" Agent: "Perfect! Let me book that for you on Tuesday at 2 PM. May I have your name and email address to confirm the appointment?" Customer: "It's John Smith, john@example.com" Agent: [Uses booking function] "Great! I've confirmed your appointment for Tuesday, March 14th at 2:00 PM Eastern Time. You'll receive a confirmation email at john@example.com with all the details." ``` **Workflow Agents** ## Add Call Booking to Workflow Agents Workflow agents allow you to create sophisticated multi-step processes. Follow these steps to add Call Booking to your workflow: ### Step 1: Navigate to Workflow Agents From your dashboard sidebar, click on **Workflow Agents**. *** ### Step 2: Select Your Workflow Click on the workflow you want to configure from the list. *** ### Step 3: Open the Workflow Editor ![Workflow Editor](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/call-booking/workflows/editor.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=ff431771007d9d3839493443233d5d95) In the workflow editor, click the **+ Add Node** button to add a new node to your workflow. *** ### Step 4: Choose Cal.com Booking ![Choose Cal.com Booking](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/call-booking/workflows/pre-click-on-node.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=46423c909c4028c2b2614f473e7a4857) Select **Cal.com Booking** from the available node types. The node will be added to your workflow canvas. *** ### Step 5: Configure the Booking Node Click on the newly added Cal.com Booking node to open the configuration panel. A configuration popup will appear with two setup modes. *** ## Configuration Modes for Workflow Agents The configuration process for workflow agents is the same as for simple agents. Choose between Static Mode and Webhook Mode based on your needs. **Static Mode** ## Static Mode Configuration Static mode fetches publicly available event types using your Cal.com username or organization slug. This is the easiest way to get started and doesn't require an API key. ### Step 1: Enter Cal.com Username or Organization Slug Enter your Cal.com **username** or **organization slug**: * **Username**: Your personal Cal.com username (e.g., `jane` if your Cal.com URL is `cal.com/jane`) * Find it in your Cal.com profile settings * **Organization Slug**: Your organization's Cal.com slug (e.g., `acme` if your team URLs are like `acme.cal.com/jane` or `schedule.acme.com/jane`) * Find it in your organization settings *** ### Step 2: Fetch Event Types ![Choose Event Type](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/call-booking/workflows/static/choosed-event.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=f062ea7387e629ad164fafeffee9463e) Click the **Fetch Event Types** button to retrieve all publicly available event types from your Cal.com account. After fetching, you'll see a dropdown list of all your available event types (e.g., "30 Minute Meeting", "Discovery Call", "Consultation"). **Choose an Event Type** from the dropdown that you want to book appointments for in this workflow step. *** > [!NOTE] > > **Static mode uses public event types**, so ensure the event type you selected is set to "Public" in your Cal.com settings. **Webhook Mode** ## Webhook Mode Configuration Webhook mode provides more control and security by using your Cal.com API key. This allows you to access private event types and configure advanced settings. ### Step 1: Enter Cal.com API Key and Event Type ID ![Enter API Key and Event Type ID](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/call-booking/workflows/webhook/post-click-on-node.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=7a292a1b499ed551c42359fdb54d8ad9) You'll need two pieces of information from your Cal.com account: #### Cal.com API Key Generate an API key from your Cal.com account: 1. Log in to [Cal.com](https://app.cal.com) 2. Navigate to **Settings** → **Security** → **API Keys** 3. Click **New API Key** 4. Give it a name (e.g., "OpenMic Workflow Integration") 5. Copy the generated API key 6. Paste it in the **API Key** field > [!WARNING] > > **Keep your API key secure**: Never share your API key publicly. It provides access to your Cal.com account and calendar data. #### Cal.com Event Type ID Find your Event Type ID: 1. Go to your Cal.com dashboard 2. Click on **Event Types** 3. Open the event type you want to use 4. Look at the URL in your browser's address bar 5. The Event Type ID is the number between the slashes * Example: `app.cal.com/event-types/123456` → Event Type ID is `123456` For more details, see [Cal.com's guide on finding Event Type IDs](https://cal.com/help/event-types/eventtype-id). #### Configure Additional Fields ![Configure Additional Fields](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/call-booking/workflows/webhook/post-click-on-node+.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=975d019f7bd2d4f65679b995804233b3) After entering your API key and Event Type ID, you'll see additional webhook configuration options: **Call a webhook before running this tool** (Optional) * Toggle this on to validate or enrich data before booking appointments * **Use the pre-call webhook URL**: Use the webhook URL configured in your workflow settings * **Custom webhook URL**: Or provide a custom webhook URL for this specific function (e.g., `https://your-domain.com/webhook/pre-booking`) *** > [!NOTE] > > **Webhook mode works with both public and private event types**, giving you more flexibility in your workflow scheduling setup. *** ### Connect the Node in Your Workflow After configuring the node (see configuration options below), connect it to other nodes in your workflow by dragging connections between nodes. This determines when the booking function will be triggered in your workflow sequence. *** ### Save Your Workflow Once you've configured and connected the Cal.com Booking node, click the **Save** button to save your workflow changes. *** *** ## Pro Tip: Combine with Check Calendar Availability > [!TIP] > > **Best Practice**: For the best user experience, combine the Call Booking function with the [Check Calendar Availability](/agents/custom-functions/check-calendar-availability) function. > > This allows your agent to: > > 1. First check available time slots when customers ask "When are you available?" > 2. Then book the appointment once the customer chooses a preferred time > > This two-step approach reduces booking conflicts and provides a smoother scheduling experience. *** ## Configuration Best Practices > **Collect Required Information First** > > * Ensure you have customer name and email before booking > * Confirm the exact date and time > * Verify timezone if dealing with customers in different regions > * Ask about any special requirements > **Write Clear Function Descriptions** > > * Be specific about when to trigger (e.g., "when customer confirms booking") > * Mention the type of appointment or meeting > * Include any prerequisites for booking > **Test Your Function Thoroughly** > > * Test with your own email first > * Try booking different time slots > * Verify confirmation emails are sent > * Check that bookings appear in your Cal.com calendar > **Handle Timezones Carefully** > > * Always specify timezone in the configuration > * Train your agent to confirm timezone with customers > * Mention timezone when confirming bookings > **Error Handling** > > * Train your agent to handle booking conflicts gracefully > * Provide alternative times if preferred slot is unavailable > * Have a fallback process for failed bookings *** ## Use Cases and Examples > **Sales Consultation Booking** > > **Scenario:** Sales agent books consultation calls automatically > > **Configuration:** > > * Mode: Static or Webhook > * Event Type: "30 Minute Sales Consultation" > * Description: "Use this when prospects confirm they want to book a consultation" > > **Agent Interaction:** > > ``` > Customer: "I'd like to schedule a consultation for Tuesday at 2 PM." > Agent: "Excellent choice! Let me get some details to book that for you. > May I have your full name and email address?" > Customer: "Sarah Johnson, sarah.j@company.com" > Agent: [Uses booking function] "Perfect! I've booked your consultation for > Tuesday, March 14th at 2:00 PM EST. You'll receive a confirmation email at > sarah.j@company.com with a calendar invite and meeting link. Looking forward > to speaking with you!" > ``` > **Medical Appointment Booking** > > **Scenario:** Healthcare practice books patient appointments > > **Configuration:** > > * Mode: Webhook (for private scheduling) > * Event Type: "Doctor Appointment" > * Description: "Use this when patients confirm they want to book an appointment" > > **Agent Interaction:** > > ``` > Patient: "I'd like to book the Monday 9 AM slot with Dr. Smith." > Agent: "I'd be happy to book that appointment for you. May I please have > your full name, date of birth, and email address?" > Patient: "Michael Brown, January 15, 1980, michael.brown@email.com" > Agent: [Uses booking function] "Thank you, Michael. I've confirmed your > appointment with Dr. Smith for Monday, March 13th at 9:00 AM. You'll receive > a confirmation email with pre-appointment instructions. Please arrive 10 minutes > early to complete any necessary paperwork." > ``` > **Service Appointment Booking** > > **Scenario:** Service business books on-site visits > > **Configuration:** > > * Mode: Static > * Event Type: "On-site Service Call" > * Description: "Use when customers confirm they want to book a service appointment" > > **Agent Interaction:** > > ``` > Customer: "Yes, I'll take the Thursday 1 PM slot for the HVAC inspection." > Agent: "Great! Let me book that for you. I'll need your name, address, and > email address please." > Customer: "Tom Wilson, 123 Main St, Anytown, tom.w@email.com" > Agent: [Uses booking function] "Perfect! I've scheduled your HVAC inspection > for Thursday, March 16th at 1:00 PM at 123 Main St. Our technician will arrive > within a 30-minute window. You'll receive a confirmation email at tom.w@email.com > and a reminder text 24 hours before the appointment." > ``` > **Interview Scheduling** > > **Scenario:** Recruiting team books candidate interviews > > **Configuration:** > > * Mode: Webhook > * Event Type: "Candidate Interview - 45 min" > * Description: "Use when candidates confirm they want to schedule an interview" > > **Agent Interaction:** > > ``` > Candidate: "Wednesday at 2 PM works perfect for me." > Agent: "Wonderful! Let me get that scheduled for you. Please confirm your > full name and the best email address to send the interview details to." > Candidate: "Emily Chen, emily.chen@email.com" > Agent: [Uses booking function] "Excellent! I've scheduled your interview for > Wednesday, March 15th at 2:00 PM PST. You'll receive a confirmation email at > emily.chen@email.com with the video call link and information about the > interview format. We're looking forward to meeting you!" > ``` *** ## Difference: Static vs Webhook Mode > **Static Mode** > > **Advantages:** > > * No API key required > * Quick and easy setup > * Perfect for public event types > * Minimal configuration needed > > **Best For:** > > * Simple booking needs > * Public-facing scheduling > * Getting started quickly > * Single-user calendars > **Webhook Mode** > > **Advantages:** > > * Access to private event types > * More configuration options > * Enhanced security > * Advanced features (custom fields, webhooks) > > **Best For:** > > * Private/internal scheduling > * Advanced configuration needs > * Team calendars > * Enterprise use cases *** ## Frequently Asked Questions > **Do I need a Cal.com account?** > > Yes, you need a Cal.com account to use this function. Cal.com offers both free and paid plans. You can sign up at [cal.com](https://cal.com). > **What's the difference between Static and Webhook mode?** > > **Static mode** fetches publicly available event types using your username/organization slug and requires no API key. **Webhook mode** uses your Cal.com API key for access to private event types and more advanced configuration options. > **How do I find my Event Type ID?** > > 1. Go to Cal.com and open your Event Types > 2. Click on the event type you want to use > 3. Look at the URL in your browser's address bar > 4. The Event Type ID is the number between the slashes (e.g., `app.cal.com/event-types/123456`) > > For more details, see [Cal.com's official guide](https://cal.com/help/event-types/eventtype-id). > **Can I book multiple event types?** > > Yes! Create multiple Call Booking functions, one for each event type. Give each function a clear name and description so your AI agent knows which one to use for different scenarios. > **What information is required to book an appointment?** > > The basic requirements are: > > * Customer name > * Customer email address > * Desired date and time > > Additional information may be required depending on your Cal.com event type configuration (phone number, custom questions, etc.). > **Will customers receive confirmation emails?** > > Yes! When an appointment is booked through this function, Cal.com automatically sends confirmation emails to the customer with calendar invites and meeting details. > **Can I cancel or reschedule bookings?** > > Bookings created through this function are standard Cal.com appointments. Customers can cancel or reschedule using the links in their confirmation emails, or you can manage them directly in your Cal.com dashboard. > **How do I handle booking conflicts?** > > Train your agent to check availability first using the **Check Calendar Availability** function before booking. If a booking fails due to a conflict, your agent should offer alternative times to the customer. > **Can I edit the function after creating it?** > > Yes, you can edit the function configuration at any time. Go to the Custom Functions tab in your agent settings and edit the function as needed. > **Does this work with team event types?** > > Yes! Both Static and Webhook modes support team event types. Just make sure to use the correct organization slug (Static mode) or Event Type ID (Webhook mode) for your team event. *** ## Troubleshooting > **Unable to fetch event types (Static Mode)** > > **Possible causes:** > > * Incorrect username or organization slug > * Event types are set to private in Cal.com > * Network connectivity issues > > **Solutions:** > > * Verify your Cal.com username/organization slug is correct > * Ensure your event types are set to "Public" in Cal.com settings > * Check your internet connection > * Try refreshing the page and fetching again > **API authentication failed (Webhook Mode)** > > **Possible causes:** > > * Invalid API key > * API key was revoked or expired > * Incorrect Event Type ID > > **Solutions:** > > * Double-check your API key is copied correctly > * Generate a new API key in Cal.com settings > * Verify the Event Type ID is correct (check the URL in Cal.com) > * Ensure the API key has the necessary permissions > **Booking fails during conversation** > > **Possible causes:** > > * Time slot no longer available > * Missing required information (name, email) > * Timezone mismatch > * Event type settings issue > > **Solutions:** > > * Check availability before booking > * Ensure all required fields are collected > * Verify timezone settings in both function and Cal.com > * Review event type configuration in Cal.com > **Customer not receiving confirmation emails** > > **Possible causes:** > > * Email address entered incorrectly > * Cal.com email notifications disabled > * Emails going to spam folder > > **Solutions:** > > * Verify email address is correct > * Check Cal.com notification settings > * Ask customer to check spam/junk folder > * Add Cal.com to safe senders list > **Function not triggering during conversations** > > **Possible causes:** > > * Function description is unclear > * Agent prompt doesn't instruct AI to use the function > * Missing customer confirmation > > **Solutions:** > > * Update the function description to be more specific > * Add clear instructions to your agent's system prompt > * Train agent to get explicit booking confirmation from customer > * Review the function execution logs *** ## Need Help? If you encounter issues or have questions about the Call Booking function: * Test with your own email first to verify setup * Review your function description and agent prompt * Check your Cal.com event type settings and availability * Verify API key permissions (webhook mode) * Review function execution logs in your dashboard * Ensure all required customer information is collected > [!NOTE] > > For technical support or questions about Cal.com integration, contact our support team. # Cal.com Availability Check Source: https://docs.openmic.ai/agents/custom-functions/check-calendar-availability Learn how to add a Cal.com calendar availability check to your AI agents to help customers find available time slots automatically. > [!NOTE] > > **Smart Scheduling**: The Check Calendar Availability function allows your AI agents to check real-time availability from your Cal.com calendars, helping customers find open time slots without manual calendar checking. ## Interactive Demo See how to set up the Check Calendar Availability function for simple agents: [Add a Cal.com Calendar Availability Check to an AI Agent](https://demo.arcade.software/vnl5JnJBFREOeKG3tjSD?embed\&embed_mobile=tab\&embed_desktop=inline\&show_copy_link=true) *** ## Overview The Check Calendar Availability function integrates your Cal.com calendars with your AI agents, enabling them to check available time slots in real-time during conversations. This powerful feature helps automate scheduling by letting your agent instantly tell customers when you're available. **Key Benefits:** * Check real-time calendar availability during conversations * Provide instant responses to "When are you available?" questions * Reduce back-and-forth scheduling coordination * Automate the first step of appointment booking **Integration:** This function uses [Cal.com](https://cal.com), a popular open-source scheduling platform. *** ## Add Check Calendar Availability to Simple Agents Follow these steps to add the Check Calendar Availability function to your AI voice agent: ### Step 1: Navigate to Simple Agents From your dashboard sidebar, click on **Simple Agents**. *** ### Step 2: Select Your Agent Click on the agent you want to configure from the list. *** ### Step 3: Open Custom Functions Tab Click on the **Custom Functions** tab in the agent configuration. *** ### Step 4: Add New Function Click the **Add Function** button to open the function selection menu. *** ### Step 5: Select Check Calendar Availability Click on **Check Calendar Availability** from the available functions. A configuration popup will appear with two setup modes. ![Choose Configuration Mode](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/check-calendar-availability/choose-option.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=27c77627c3dc6bb1ce7bf09f17dadf69) *** ## Configuration Modes Cal.com offers two ways to connect your calendar: **Static Mode** (no API key required) and **Webhook Mode** (requires API key for more control). Choose the mode that best fits your needs. **Static Mode** ## Static Mode Configuration Static mode fetches publicly available event types using your Cal.com username or organization slug. This is the easiest way to get started and doesn't require an API key. ### Step 1: Enter Cal.com Username or Organization Slug ![Enter Username or Organization Slug](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/check-calendar-availability/static/step-1.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=9767ffa24b884d9a38f49b04b44d7f63) Enter your Cal.com **username** or **organization slug**: * **Username**: Your personal Cal.com username (e.g., `jane` if your Cal.com URL is `cal.com/jane`) * Find it in your Cal.com profile settings * **Organization Slug**: Your organization's Cal.com slug (e.g., `acme` if your team URLs are like `acme.cal.com/jane` or `schedule.acme.com/jane`) * Find it in your organization settings *** ### Step 2: Fetch Event Types ![Fetch Event Types](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/check-calendar-availability/static/step-2.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=ac877862d307e0a1e4fd540d4f115df3) Click the **Fetch Event Types** button to retrieve all publicly available event types from your Cal.com account. After fetching, you'll see a dropdown list of all your available event types (e.g., "30 Minute Meeting", "Discovery Call", "Consultation"). **Choose an Event Type** from the dropdown that you want your AI agent to check availability for. *** ### Step 3: Configure Function Options ![Configure Function Options](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/check-calendar-availability/static/step-3.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=e8a5dc0eef5d808ed3e4aef6fe547423) Configure the following options: #### Function Name Give your function a descriptive name in snake\_case (e.g., `check_30min_meeting_availability`, `check_consultation_slots`). #### Description Describe when this function should be used. This helps the AI understand when to check availability. **Examples:** * "Use this when the customer asks about available time slots for a consultation" * "Check this when the customer wants to know when I'm free for a meeting" * "Use this to find available appointment times" #### Timezone (Optional) Specify the timezone for checking availability (e.g., `America/New_York` or `Europe/London`). If not provided, Cal.com will use its default timezone (UTC). *** ### Step 4: Create Function Click **Create Function** to save your configuration. The function is now ready to use! *** ### Step 5: Test the Function Test your newly created function: 1. Start a call or conversation with your AI agent 2. Ask your agent to check for available slots, for example: * "What times are available this week?" * "When is the next available appointment?" * "Show me available slots for next Monday" Your agent will use the function to fetch real-time availability from your Cal.com calendar and respond with open time slots. > [!NOTE] > > **Static mode uses public event types**, so ensure the event type you selected is set to "Public" in your Cal.com settings. **Webhook Mode** ## Webhook Mode Configuration Webhook mode provides more control and security by using your Cal.com API key. This allows you to access private event types and configure advanced settings. ### Step 1: Enter Cal.com API Key and Event Type ID ![Enter API Key and Event Type ID](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/check-calendar-availability/webhook/step-1.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=a5a1521e202ec2971ba6e7061ac2b075) You'll need two pieces of information from your Cal.com account: #### Cal.com API Key Generate an API key from your Cal.com account: 1. Log in to [Cal.com](https://app.cal.com) 2. Navigate to **Settings** → **Security** → **API Keys** 3. Click **New API Key** 4. Give it a name (e.g., "OpenMic Integration") 5. Copy the generated API key 6. Paste it in the **API Key** field > [!WARNING] > > **Keep your API key secure**: Never share your API key publicly. It provides access to your Cal.com account and calendar data. #### Cal.com Event Type ID Find your Event Type ID: 1. Go to your Cal.com dashboard 2. Click on **Event Types** 3. Open the event type you want to use 4. Look at the URL in your browser's address bar 5. The Event Type ID is the number between the slashes * Example: `app.cal.com/event-types/123456` → Event Type ID is `123456` For more details, see [Cal.com's guide on finding Event Type IDs](https://cal.com/help/event-types/eventtype-id). #### Configure Additional Fields ![Configure Additional Fields](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/check-calendar-availability/webhook/step-1+.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=71ee6d54d341de576edc521f0223dee3) After entering your API key and Event Type ID, you'll see additional webhook configuration options: **Call a webhook before running this tool** (Optional) * Toggle this on to validate or enrich data before checking availability * **Use the pre-call webhook URL**: Use the webhook URL configured in your agent settings * **Custom webhook URL**: Or provide a custom webhook URL for this specific function (e.g., `https://your-domain.com/webhook/pre-tool`) Click **Next** to proceed to the function configuration. *** ### Step 2: Configure Function Options ![Configure Function Options](https://mintcdn.com/openmic-ea75a20d/QwyyEXVo8-7DwQxf/images/agents/custom-functions/check-calendar-availability/webhook/step-2.png?fit=max\&auto=format\&n=QwyyEXVo8-7DwQxf\&q=85\&s=be2bffed1b8aab0a8838457f2fb0f1d2) Configure the following options: #### Function Name Give your function a descriptive name in snake\_case (e.g., `check_private_calendar_availability`, `check_team_meeting_slots`). #### Description Describe when this function should be used. This helps the AI understand when to check availability. **Examples:** * "Use this when the customer asks about available consultation times" * "Check this when someone wants to schedule a private meeting" * "Use this to find available slots for team calls" *** ### Step 3: Create Function Click **Create Function** to save your configuration. The function is now ready to use! *** ### Step 4: Test the Function Test your newly created function: 1. Start a call or conversation with your AI agent 2. Ask your agent to check for available slots, for example: * "What times are available this week?" * "When is the next available appointment?" * "Show me available slots for next Monday" Your agent will use the function to fetch real-time availability from your Cal.com calendar and respond with open time slots. > [!NOTE] > > **Webhook mode works with both public and private event types**, giving you more flexibility in your scheduling setup. *** ## Update Your Agent Prompt To help your AI agent use the calendar check function effectively, add instructions to your bot's system prompt: ``` When customers ask about availability, available time slots, or when they can schedule an appointment, use the check_calendar_availability function to fetch real-time available slots from the calendar. Present the available times in a clear, conversational way and help the customer choose a time that works for them. Example responses: - "Let me check my calendar for you. I have availability on Tuesday at 2 PM, Wednesday at 10 AM, and Thursday at 3 PM. Which works best for you?" - "I see several open slots this week. Would you prefer morning or afternoon?" ``` *** ## Configuration Best Practices > **Write Clear Function Descriptions** > > * Be specific about when to trigger (e.g., "when customers ask about availability") > * Mention the type of appointment or meeting > * Include example questions customers might ask > **Test Your Function** > > * Test with your own calendar first > * Try asking different availability questions > * Verify the agent responds with correct time slots > **Handle Timezones** > > * Specify timezone in the configuration if needed > * Train your agent to clarify timezone with customers > * Always mention timezone when presenting available slots *** ## Use Cases and Examples > **Sales Consultation Scheduling** > > **Scenario:** Sales agent checks availability for consultation calls > > **Configuration:** > > * Mode: Static or Webhook > * Event Type: "30 Minute Sales Consultation" > * Description: "Check this when prospects ask about scheduling a consultation call" > > **Agent Interaction:** > > ``` > Customer: "I'd like to schedule a consultation to discuss your services." > Agent: "I'd be happy to schedule that for you! Let me check my availability... > I have openings on Tuesday at 2 PM, Wednesday at 10 AM, and Friday at 3 PM. > Which time works best for you?" > ``` > **Medical Appointment Booking** > > **Scenario:** Healthcare practice checks doctor availability > > **Configuration:** > > * Mode: Webhook (for private scheduling) > * Event Type: "Doctor Appointment" > * Description: "Use this when patients ask about available appointment times" > > **Agent Interaction:** > > ``` > Patient: "When is Dr. Smith available next week?" > Agent: "Let me check Dr. Smith's schedule for you... She has availability > next Monday at 9 AM, Tuesday at 2 PM, and Thursday at 11 AM. Would any of > these times work for you?" > ``` > **Service Provider Scheduling** > > **Scenario:** Service business checks technician availability > > **Configuration:** > > * Mode: Static > * Event Type: "On-site Service Call" > * Description: "Check when customers need to schedule a service appointment" > > **Agent Interaction:** > > ``` > Customer: "I need someone to come look at my HVAC system. When can you come?" > Agent: "I can help you with that! Let me check our technician availability... > We have open slots this Thursday at 1 PM, Friday at 10 AM, or next Monday at 3 PM. > Which would you prefer?" > ``` > **Interview Scheduling** > > **Scenario:** Recruiting team checks interviewer availability > > **Configuration:** > > * Mode: Webhook > * Event Type: "Candidate Interview - 45 min" > * Description: "Use when candidates need to schedule an interview" > > **Agent Interaction:** > > ``` > Candidate: "I'd like to schedule my interview. What times do you have available?" > Agent: "Thank you for your interest! Let me check our interview slots... > We have availability this week on Wednesday at 11 AM, Thursday at 2 PM, and > Friday at 4 PM. Which works best with your schedule?" > ``` *** ## Difference: Static vs Webhook Mode > **Static Mode** > > **Advantages:** > > * No API key required > * Quick and easy setup > * Perfect for public event types > * Minimal configuration needed > > **Best For:** > > * Simple scheduling needs > * Public-facing availability > * Getting started quickly > * Single-user calendars > **Webhook Mode** > > **Advantages:** > > * Access to private event types > * More configuration options > * Enhanced security > * Advanced features (buffer times, custom ranges) > > **Best For:** > > * Private/internal scheduling > * Advanced configuration needs > * Team calendars > * Enterprise use cases *** ## Frequently Asked Questions > **Do I need a Cal.com account?** > > Yes, you need a Cal.com account to use this function. Cal.com offers both free and paid plans. You can sign up at [cal.com](https://cal.com). > **What's the difference between Static and Webhook mode?** > > **Static mode** fetches publicly available event types using your username/organization slug and requires no API key. **Webhook mode** uses your Cal.com API key for access to private event types and more advanced configuration options. > **How do I find my Event Type ID?** > > 1. Go to Cal.com and open your Event Types > 2. Click on the event type you want to use > 3. Look at the URL in your browser's address bar > 4. The Event Type ID is the number between the slashes (e.g., `app.cal.com/event-types/123456`) > > For more details, see [Cal.com's official guide](https://cal.com/help/event-types/eventtype-id). > **Can I check availability for multiple event types?** > > Yes! Create multiple Check Calendar Availability functions, one for each event type. Give each function a clear name and description so your AI agent knows which one to use for different scenarios. > **Will this automatically book appointments?** > > No, this function only *checks* availability. It doesn't book appointments. To enable booking, you'll need to use the **Call Booking** function (a separate custom function) or direct your customers to your Cal.com booking page. > **How real-time is the availability check?** > > The availability is checked in real-time when the function is triggered, so your agent always has the most up-to-date information from your Cal.com calendar. > **What happens if there's no availability?** > > Your AI agent will receive the information that no slots are available and can communicate this to the customer. Make sure to train your agent prompt to handle this scenario gracefully (e.g., "I don't have any availability this week, but I have several openings next week. Would you like me to check those?"). > **Can I edit the function after creating it?** > > Yes, you can edit the function configuration at any time. Go to the Custom Functions tab in your agent settings and edit the function as needed. *** ## Troubleshooting > **Unable to fetch event types (Static Mode)** > > **Possible causes:** > > * Incorrect username or organization slug > * Event types are set to private in Cal.com > * Network connectivity issues > > **Solutions:** > > * Verify your Cal.com username/organization slug is correct > * Ensure your event types are set to "Public" in Cal.com settings > * Check your internet connection > * Try refreshing the page and fetching again > **API authentication failed (Webhook Mode)** > > **Possible causes:** > > * Invalid API key > * API key was revoked or expired > * Incorrect Event Type ID > > **Solutions:** > > * Double-check your API key is copied correctly > * Generate a new API key in Cal.com settings > * Verify the Event Type ID is correct (check the URL in Cal.com) > * Ensure the API key has the necessary permissions > **Function not triggering during conversations** > > **Possible causes:** > > * Function description is unclear > * Agent prompt doesn't instruct AI to use the function > * Customer's request doesn't match expected triggers > > **Solutions:** > > * Update the function description to be more specific > * Add clear instructions to your agent's system prompt > * Test with explicit phrases like "check availability" or "show available times" > * Review the function execution logs *** ## Need Help? If you encounter issues or have questions about the Check Calendar Availability function: * Test with your own calendar first to verify setup * Review your function description and agent prompt * Check your Cal.com event type settings * Verify API key permissions (webhook mode) * Review function execution logs in your dashboard > [!NOTE] > > For technical support or questions about Cal.com integration, contact our support team. # Send Email Source: https://docs.openmic.ai/agents/custom-functions/send-email Configure email sending capabilities to send automated emails during conversations ## Interactive Demo See the Send Email feature in action: [Send Email with Custom Function in OpenMic Bot](https://demo.arcade.software/aiVpf9yZmJs3v7iuWoUl?embed\&embed_mobile=tab\&embed_desktop=inline\&show_copy_link=true) *** ## Overview The Send Email function empowers your AI agent to send personalized emails automatically during conversations, transforming your bot into a complete communication solution. This feature enables: * **Automated follow-ups**: Send confirmation emails, receipts, or documentation after calls * **Team collaboration**: Forward call summaries and notifications to team members * **Lead nurturing**: Send personalized follow-up emails with meeting details or resources * **Real-time alerts**: Notify stakeholders about important conversations or urgent matters Using industry-standard SMTP (Simple Mail Transfer Protocol), your agent connects securely to any email provider. Configure reusable email templates that populate automatically based on conversation context, or enable [runtime inputs](#6-configure-runtime-options) for AI-generated content. ## Configuration Steps ### 1. Add Send Email Function Start by adding the Send Email function to your bot: 1. Navigate to your bot's **Settings** → **Custom Functions** 2. Click **Add Function** and select **Send Email** 3. The function will be automatically named `send_email` (this is the name you'll use in your agent prompts) ![Adding a custom function in OpenMic](https://mintcdn.com/openmic-ea75a20d/Wui9ESyRdZvZOVFx/images/add-custom-function.png?fit=max\&auto=format\&n=Wui9ESyRdZvZOVFx\&q=85\&s=f8b7732beb54bafa401fdbc37cb772b8) ### 2. Configure Basic Settings ![Editing send email configuration](https://mintcdn.com/openmic-ea75a20d/_WfeIA_ydQ_VPM2S/images/agents/custom-functions/send-email/send-email.png?fit=max\&auto=format\&n=_WfeIA_ydQ_VPM2S\&q=85\&s=a459569fcb8838a5ead4a70db0b80fb5) **Function Name** * The function name is automatically set to `send_email` (snake\_case) * This name will be used by the AI to trigger the email sending function **Description** * Optional description to help identify the purpose of this email function * Useful when you have multiple email functions configured ### 3. Configure SMTP Settings Configure your SMTP server settings to connect to your email provider: **SMTP Host** * Enter your email provider's SMTP server address * Examples: * Gmail: `smtp.gmail.com` * Outlook: `smtp-mail.outlook.com` * Custom: `smtp.example.com` **Port** * Enter the SMTP port number * Common ports: * **465**: SSL/TLS (secure connection) * **587**: STARTTLS (secure connection) * **25**: Unsecured (not recommended) **Secure** * Toggle this option to enable SSL/TLS encryption * **Recommended**: Keep this enabled for security * Required for ports 465 and 587 with most providers **Username** * Enter your email account username (usually your email address) * Example: `user@example.com` **Password** * Enter your SMTP password or app-specific password * Some providers require app-specific passwords instead of regular passwords * For Gmail setup instructions, see the [Gmail SMTP Setup](#gmail-smtp-setup) below * This password is stored securely and encrypted ### 4. Quick Setup Guides Choose your email provider below for detailed setup instructions: #### Gmail SMTP Setup Follow this step-by-step guide to configure Gmail for sending emails through your OpenMic agent. Gmail offers excellent deliverability and security features, making it a popular choice for automated email sending. ### Prerequisites * A Google/Gmail account * Two-factor authentication enabled on your Gmail account (recommended for security) * Access to your Google Account security settings ### Step 1: Enable Two-Factor Authentication (2FA) Before setting up App Passwords, you need 2FA enabled on your Gmail account: 1. Go to your [Google Account settings](https://myaccount.google.com/) 2. Navigate to **Security** in the left sidebar 3. Under "Signing in to Google", click **2-Step Verification** 4. Follow the prompts to enable 2FA using your preferred method (authenticator app, SMS, etc.) > [!NOTE] > > **Why 2FA is required**: App Passwords can only be created for accounts with > 2FA enabled. This adds an extra layer of security to your email setup. ### Step 2: Generate an App Password App Passwords allow OpenMic to send emails through your Gmail account securely: 1. Go to your [Google Account settings](https://myaccount.google.com/) 2. Navigate to **Security** in the left sidebar 3. Under "Signing in to Google", click **App passwords** 4. You may need to sign in again and verify your identity 5. Select **Mail** as the app type 6. Select **Other (custom name)** as the device type 7. Enter "OpenMic Bot" as the custom name 8. Click **Generate** > [!WARNING] > > **Save your App Password immediately**: Google will show you the > 16-character password only once. Copy it and store it securely - you'll need > it for the SMTP configuration. ##### Step 3: Configure SMTP Settings in OpenMic Return to your OpenMic bot and enter these Gmail SMTP settings: * **SMTP Host**: `smtp.gmail.com` * **Port**: `587` (recommended for most setups) or `465` * **Secure**: Enable this checkbox * **Username**: Your complete Gmail address (e.g., `yourname@gmail.com`) * **Password**: Paste the 16-character App Password (not your regular Gmail password) ##### Step 4: Test Your Configuration Before using in production, test your setup: 1. Save your SMTP configuration 2. Create a test email with your own email address as the recipient 3. Send a test email to verify everything works 4. Check your inbox and spam folder 5. Verify the email was sent from your Gmail account If you encounter issues, see the [Gmail SMTP troubleshooting](#troubleshooting-gmail-smtp-issues) below or the general [troubleshooting section](#troubleshooting). ##### Step 5: Configure Email Composition Set up your email template: **From**: `"Your Bot Name" `\ **To**: Use the Runtime Inputs to determine the recipients\ **Subject**: `"Message from Your AI Assistant"`\ **HTML Body**: Create a professional email template ##### Troubleshooting Gmail SMTP Issues > **App Password not working** > > **Solutions:** > > * Verify 2FA is enabled on your Google account > * Regenerate the App Password if it was compromised > * Ensure you're using the full 16-character password (no spaces) > * Try using a different device/browser to generate the password > **Authentication failed** > > **Possible causes:** > > * Using regular Gmail password instead of App Password > * App Password was revoked or expired > * Account has security restrictions > > **Solutions:** > > * Generate a new App Password > * Check if your Google account has security alerts > * Verify your account hasn't been suspended > * Try signing out and back in to your Google account > **Emails going to spam** > > **Solutions:** - Send a few test emails to warm up your account - Add your > recipients to your Gmail contacts - Avoid spam trigger words in subject > lines - Use a custom "From" name that matches your business - Consider > setting up SPF/DKIM records if using a custom domain > **Daily sending limits** > > Gmail has sending limits to prevent abuse: > > * **500 emails per day** for regular accounts > * **Higher limits** available for Google Workspace accounts > > **Solutions:** > > * Monitor your sending volume > * Upgrade to Google Workspace for higher limits > * Consider using a dedicated SMTP service for high-volume sending ##### Best Practices for Gmail SMTP * **Security**: Always use App Passwords, never your regular Gmail password * **Monitoring**: Regularly check your [Google Account activity](https://myaccount.google.com/security) for suspicious login attempts * **Backup**: Have alternative email sending methods ready * **Limits**: Be aware of Gmail's [daily sending limits](https://support.google.com/mail/answer/22839) (500 emails for personal accounts) * **Testing**: Test thoroughly before deploying to production (see [Testing](#test-your-configuration) above) * **Updates**: Monitor Google's policy changes that might affect SMTP access ### 5. Compose Email Message Configure the email content that will be sent: **From** * **Required**: The sender's email address * Can include a display name: `"Sender Name" ` * Must match the authenticated SMTP account **To** * Primary recipient email address(es) * Multiple recipients: `bar@example.com, baz@example.com` **Cc** (Optional) * Carbon copy recipients * Same format as "To" field **Bcc** (Optional) * Blind carbon copy recipients * Recipients won't see other Bcc addresses **Subject** * Email subject line * Can be left empty if using runtime inputs (see Runtime Options below) **Text Body** (Optional) * Plain text version of the email * Use this for simple text-only emails **HTML Body** (Optional) * HTML formatted version of the email * Use this for rich formatting, links, and styling > [!WARNING] > > **At least one recipient required**: You must provide at least one recipient > in the To, Cc, or Bcc field (unless using runtime inputs). Similarly, either > Text Body or HTML Body must be provided (unless using runtime inputs). ### 6. Configure Runtime Options ![Runtime options configuration](https://mintcdn.com/openmic-ea75a20d/_WfeIA_ydQ_VPM2S/images/agents/custom-functions/send-email/runtime-options.png?fit=max\&auto=format\&n=_WfeIA_ydQ_VPM2S\&q=85\&s=4814189180af04f291c0fe6232e36b8c) Enable dynamic email content that can be filled by the AI during the conversation: **Allow runtime inputs to override empty fields** * When enabled, the AI can fill in empty email fields during the conversation * Useful when you want the AI to determine recipients or compose content dynamically * Fields marked as "LLM allowed" will be disabled in the form and filled by the AI **Fields the LLM may supply** Select which fields the AI is allowed to populate: * **To**: Allow AI to determine recipient email address(es) * **Text**: Allow AI to compose the plain text body * **HTML**: Allow AI to compose the HTML body > [!NOTE] > > When a field is marked as "LLM allowed", it becomes disabled in the form. > The AI will fill this field based on the conversation context when the > function is triggered. **How Runtime Inputs Work:** 1. You configure a base email template with some fields pre-filled (e.g., From, Subject) 2. You mark certain fields as "LLM allowed" (e.g., To, Text) 3. During the conversation, when the AI triggers `send_email`, it will: * Use your pre-filled values for non-LLM fields * Dynamically fill LLM-allowed fields based on the conversation context * Send the complete email Example use case: * Pre-configure: From, Subject, HTML template * LLM allowed: To, Text * Result: AI sends personalized emails to different recipients with custom content ## Best Practices ### Update Your Agent Prompt Train your AI agent to use email effectively by adding these instructions to your bot's system prompt: ``` When users request email summaries, confirmations, or want information sent via email, automatically use the send_email function to fulfill their requests. At the end of successful calls, send a confirmation email containing the call summary and any agreed-upon next steps. ``` ### Choose Between Text and HTML * **Text Body**: Best for simple, reliable emails that display consistently across all email clients * **HTML Body**: Ideal for branded emails with formatting, images, and professional styling * **Both**: Provide both versions for maximum compatibility - email clients automatically choose the best format ### Secure Your SMTP Credentials * Never share your SMTP password * Use app-specific passwords when available (Gmail, Outlook) * Consider using environment variables or secure credential storage * Rotate passwords regularly ### Test Your Configuration Before deploying to production: 1. Send a test email to yourself 2. Check that emails arrive in inbox (not spam) 3. Test with different email providers 4. Verify HTML rendering in different email clients ### Handle Multiple Recipients When sending to multiple recipients: * Use comma-separated values: `email1@example.com, email2@example.com` * Consider using Bcc for privacy when sending to multiple unrelated recipients * Use Cc when recipients should see each other's addresses ### Use Runtime Inputs for Flexibility **Enable runtime inputs when you need:** * Dynamic recipients that change based on conversation context * AI-generated email content personalized for each user * Flexible email composition that adapts to different scenarios **Use static templates when you need:** * Consistent, branded emails with fixed content * Emails sent to the same recipients every time * Complete control over exact wording and formatting ## Advanced Configuration ### Rate Limiting and Email Quotas Be aware of email provider limitations to avoid sending failures: * **Gmail**: 500 emails/day for personal accounts, 5,000/day for Google Workspace * **Outlook/Hotmail**: 300 emails/day * **Yahoo**: 500 emails/day * **Custom SMTP**: Check your provider's limits **Best practices:** * Monitor your sending volume regularly * Implement sending limits in your agent prompts * Consider upgrading to business email plans for higher limits * Use dedicated transactional email services (SendGrid, Mailgun) for high-volume sending ### Email Deliverability Optimization Ensure your emails reach the inbox, not spam: **Authentication Setup:** * Configure SPF records for your sending domain * Add DKIM signatures for email verification * Set up DMARC policies to prevent spoofing **Content Optimization:** * Use recognizable sender names and addresses * Avoid spam trigger words in subjects ("free", "urgent", "guarantee") * Include clear unsubscribe links for marketing emails * Maintain a clean sending reputation **Technical Best Practices:** * Warm up new email accounts gradually (start with 10-20 emails/day) * Monitor bounce rates and unsubscribe rates * Use consistent sending patterns * Avoid sending to inactive or invalid addresses ### Monitoring and Analytics Track email performance to improve your setup: **Key Metrics to Monitor:** * **Delivery Rate**: Percentage of emails that reach recipients' inboxes * **Open Rate**: Percentage of delivered emails that are opened * **Bounce Rate**: Percentage of emails that fail to deliver * **Spam Complaints**: Recipients marking your emails as spam **OpenMic-Specific Monitoring:** * Check the function execution logs in your bot dashboard * Monitor for SMTP connection errors * Track successful email sends vs. failures * Review conversation logs to see when emails are triggered ### Security Considerations Protect your email infrastructure: **Credential Security:** * Use app-specific passwords instead of regular passwords * Rotate passwords regularly (every 3-6 months) * Store credentials securely (never in code or shared documents) * Limit access to email configuration settings **Connection Security:** * Always enable SSL/TLS encryption (ports 465 or 587) * Use reputable email providers with strong security * Monitor for unusual sending patterns that might indicate compromise * Implement rate limiting to prevent abuse **Data Protection:** * Avoid sending sensitive information via email when possible * Use encryption for highly sensitive content * Comply with data protection regulations (GDPR, CCPA) * Implement proper data retention policies ## Example Use Cases > **Team Notification** > > Send email notifications to your team when important calls occur. > > **Setup:** > > * Configure SMTP settings > * Set From: `"OpenMic Bot" ` > * Set To: `team@yourcompany.com` > * Set Subject: `"Important Call Alert - {contact.name}"` > * Set HTML Body with call details > * Update agent prompt: "If the caller mentions they want to speak with a manager or has an urgent issue, send an email to the team" > > This keeps your team informed about important conversations in real-time. > **Appointment Confirmation** > > Send appointment confirmation emails with details extracted from the conversation. > > **Setup:** > > * Configure SMTP > * Set From: `"Appointments" ` > * Set To: `[contact.email]` > * Set Subject: `"Appointment Confirmed"` > * Set HTML Body with appointment details > * Enable runtime inputs for To and HTML to allow dynamic content > * Update agent prompt: "After scheduling an appointment, send a confirmation email with all details" > > This provides customers with written confirmation and reduces no-shows. > **Dynamic Lead Routing** > > Route lead information via email to different sales reps based on conversation context. > > **Setup:** > > * Configure SMTP > * Set From: `"Lead System" ` > * Leave To empty, enable runtime inputs for To field > * Set Subject: `"New Lead"` > * Set HTML Body template with lead information > * Enable runtime inputs for To and HTML > * Update agent prompt: "After qualifying a lead, send their information to the appropriate sales rep based on their location/product interest" > > This ensures leads are automatically routed to the right team member. > **Follow-up Email Sequence** > > Send follow-up emails with resources or next steps after specific conversation topics. > > **Setup:** > > * Configure SMTP > * Set From: `"Support" ` > * Set To: `[contact.email]` > * Set Subject: `"Resources"` > * Set HTML Body with links and information > * Enable runtime inputs for Subject and HTML to personalize content > * Update agent prompt: "When a caller asks about \[specific topic], send them a follow-up email with relevant resources and links" > > This provides additional value and keeps the conversation going beyond the call. ## Troubleshooting > **Email not sending** > > **Possible causes:** > > * Invalid SMTP credentials (username/password) > * Incorrect SMTP host or port > * Firewall blocking SMTP port > * Email provider blocking authentication attempts > > **Solutions:** > > * Verify SMTP credentials are correct > * Check SMTP host and port match your email provider's requirements > * Ensure "Secure" is enabled for ports 465/587 > * Use app-specific passwords for providers that require them (see Quick Setup Guides above) > * Verify firewall rules allow outbound connections on SMTP port > **Emails going to spam** > > **Possible causes:** > > * Sender email not authenticated properly > * Missing or invalid SPF/DKIM records > * Suspicious email content > * Sending from a new or unverified domain > > **Solutions:** > > * Ensure "From" address matches the authenticated SMTP account > * Configure SPF and DKIM records for your domain > * Use a verified domain for sending emails > * Avoid spam trigger words in subject and body > * Include unsubscribe links for marketing emails > * Warm up your sending domain gradually if sending high volumes > **Runtime inputs not working** > > **Possible causes:** > > * Runtime inputs not enabled > * Field not marked as "LLM allowed" > * AI doesn't have enough context to fill the field > * Agent prompt doesn't instruct AI to use the function > > **Solutions:** > > * Enable "Allow runtime inputs to override empty fields" > * Mark the desired fields as "LLM allowed" (To, Text, or HTML) > * Update agent prompt to instruct when and how to use send\_email > * Provide clear context in the conversation for the AI to extract information > * Test with explicit instructions in the agent prompt > **HTML email not rendering correctly** > > **Possible causes:** > > * Invalid HTML syntax > * Email client doesn't support certain HTML features > * Missing closing tags > * Inline styles not used (some clients strip `