# Calendly
### What It Does

Calendly sends appointment events in real time to DURUM.ai. Each Calendly event type is mapped to a type in DURUM.ai.

| Calendly Event | Type in DURUM.ai | When |
|---------------|-----------------|------|
| invitee.created | Booking | A prospect books a time slot |
| invitee.canceled | Cancellation | The prospect cancels their appointment |
| invitee.no_show | No-show | The prospect doesn't show up |

### Step-by-Step Configuration

#### Option A: Via Calendly Developer Portal (Recommended)

1. Log in to your Calendly account
2. Go to **https://developer.calendly.com/** (or in your Calendly profile, section **Integrations** then **API & Webhooks**)
3. Click **Webhooks** in the sidebar
4. Click **Create Webhook Subscription**

You need to create **3 subscriptions** (one per event type):

**Subscription 1: Bookings and Cancellations**

5. In the **Callback URL** field, enter:
   ```
   https://app.durum.ai/api/webhook/booking?client_key=YOUR_KEY
   ```
6. In **Events**, select:
   - `invitee.created`
   - `invitee.canceled`
7. Click **Create Webhook Subscription**

**Subscription 2: No-shows**

8. Click **Create Webhook Subscription** again
9. In the **Callback URL** field, enter:
   ```
   https://app.durum.ai/api/webhook/no-show?client_key=YOUR_KEY
   ```
10. In **Events**, select:
    - `invitee.no_show`
11. Click **Create Webhook Subscription**

#### Option B: Via Calendly Interface (If Available)

1. Log in to Calendly
2. Go to **Integrations** from the sidebar
3. Find the **Webhooks** section
4. Add the same URLs and events as in Option A

### How to Test

1. Create a test appointment on your Calendly link (use a test email)
2. Wait 30 seconds
3. In DURUM.ai, go to **Data Logs**
4. You should see a `booking` event with status `success`
5. Cancel the test appointment in Calendly
6. Verify that a `booking_cancel` event appears in the logs

### Calendly Troubleshooting

| Problem | Solution |
|---------|----------|
| Event doesn't appear | Verify the subscription is active in the Calendly developer portal |
| Error 401 | Verify that the `client_key` in the URL is correct |
| Duplicates | DURUM.ai automatically handles deduplication via the Calendly URI. No action required. |
| No-shows don't appear | Verify you created a separate subscription for `invitee.no_show` |

> **Tip**
>
> Bookings and cancellations use the **same URL** (`/api/webhook/booking`). DURUM.ai automatically detects whether it's a creation or cancellation through the Calendly event type (`invitee.created` vs `invitee.canceled`).

---

---

Source: https://docs.durum.ai/en/integrations/calendly
