# Calendly

Calendly is an online scheduling platform that helps individuals and teams automate meeting scheduling, event types, and calendar management. The Sling Calendly connector extracts data from the Calendly API v2, supporting users, event types, scheduled events, organization memberships, routing forms, and routing form submissions.

{% hint style="success" %}
**CLI Pro Required**: APIs require a [CLI Pro token](https://docs.slingdata.io/sling-cli/cli-pro) or [Platform Plan](https://docs.slingdata.io/sling-platform/platform).
{% endhint %}

## Setup

The following credentials are accepted:

**Secrets:**

* `api_token` **(required)** -> Your Calendly Personal Access Token

### Getting Your API Token

1. Log in to [Calendly](https://calendly.com)
2. Go to **Integrations & apps** in the left sidebar
3. Navigate to **API & Webhooks**
4. Click **Get a token now** under **Personal Access Tokens**
5. Enter a name for your token and click **Create Token**
6. Copy the generated token

{% hint style="warning" %}
**Important:** Personal Access Tokens grant full access to your Calendly account. Keep them secure and do not share them. Tokens are only shown once at creation time.
{% endhint %}

### Using `sling conns`

Here are examples of setting a connection named `CALENDLY`. We must provide the `type=api` property:

{% code overflow="wrap" %}

```bash
sling conns set CALENDLY type=api spec=calendly secrets='{ api_token: your_personal_access_token }'
```

{% endcode %}

### Environment Variable

See [here](https://docs.slingdata.io/sling-cli/environment#dot-env-file-.env.sling) to learn more about the `.env.sling` file.

{% code overflow="wrap" %}

```bash
export CALENDLY='{ type: api, spec: calendly, secrets: { api_token: "your_personal_access_token" } }'
```

{% endcode %}

### Sling Env File YAML

See [here](https://docs.slingdata.io/sling-cli/environment#sling-env-file-env.yaml) to learn more about the sling `env.yaml` file.

```yaml
connections:
  CALENDLY:
    type: api
    spec: calendly
    secrets:
      api_token: "your_personal_access_token"
```

## Replication

Here's an example replication configuration to sync Calendly data to a PostgreSQL database:

```yaml
source: CALENDLY
target: MY_POSTGRES

defaults:
  mode: full-refresh
  object: calendly.{stream_name}

streams:
  # sync all endpoints
  '*':
```

**Sync specific endpoints:**

```yaml
source: CALENDLY
target: MY_POSTGRES

defaults:
  mode: full-refresh
  object: calendly.{stream_name}

streams:
  current_user:
  event_types:
  scheduled_events:
    mode: incremental
    primary_key: [uri]
    update_key: start_time
  organization_memberships:
  routing_forms:
  routing_form_submissions:
```

## Endpoints

| Endpoint                   | Description                                | Incremental | Depends On      |
| -------------------------- | ------------------------------------------ | ----------- | --------------- |
| `current_user`             | The authenticated user's profile           | No          | —               |
| `event_types`              | All event types for the authenticated user | No          | —               |
| `scheduled_events`         | All scheduled events for the organization  | Yes         | —               |
| `organization_memberships` | Organization membership records            | No          | —               |
| `routing_forms`            | Routing forms for the organization         | No          | —               |
| `routing_form_submissions` | Submissions for each routing form          | No          | `routing_forms` |

The connector uses a **queue-based architecture** for hierarchical data. The `routing_forms` endpoint populates routing form URIs used by `routing_form_submissions` to fetch submissions per form.

To discover available endpoints:

```bash
sling conns discover CALENDLY
```

### Endpoint Details

**`current_user`** — Returns the authenticated user's profile, including name, email, scheduling URL, organization URI, and timezone.

**`event_types`** — Returns all event types created by the authenticated user, including event name, duration, color, scheduling URL, and availability settings.

**`scheduled_events`** — Returns all scheduled events across the organization. Supports **incremental sync** using `start_time` as the update key, so subsequent runs only fetch events newer than the last sync. Includes event name, start/end times, status, location, guests, and calendar event details.

**`organization_memberships`** — Returns all memberships in the user's organization, including member roles, creation timestamps, and user details.

**`routing_forms`** — Returns all routing forms configured for the organization, including form name, questions, and routing rules.

**`routing_form_submissions`** — Returns all submissions for each routing form. Iterates over routing form URIs collected from the `routing_forms` endpoint. Includes submitted answers, tracking parameters, and submission timestamps.

### Incremental Sync

The `scheduled_events` endpoint supports incremental sync using the `start_time` field. On the first run, it fetches events from the past year (or from a custom `anchor_date` input). On subsequent runs, it only fetches events with a start time newer than the last synced value.

To customize the starting date for the first sync, pass the `anchor_date` input:

```yaml
source:
  conn: CALENDLY
  inputs:
    anchor_date: "2024-01-01T00:00:00Z"
```

## Rate Limiting

The Calendly API enforces rate limits:

* **Standard limit:** 5 requests per second

The connector automatically:

* Uses conservative rate limiting (5 requests/second with concurrency of 3)
* Retries with exponential backoff on 429 (rate limit) responses, up to 5 attempts

## Common Use Cases

### Sync All Calendly Data

```yaml
source: CALENDLY
target: MY_POSTGRES

defaults:
  mode: full-refresh
  object: calendly.{stream_name}

streams:
  '*':
```

### Incremental Event Sync

```yaml
source: CALENDLY
target: MY_POSTGRES

defaults:
  mode: full-refresh
  object: calendly.{stream_name}

streams:
  scheduled_events:
    mode: incremental
    primary_key: [uri]
    update_key: start_time
```

### Export Event Types and Scheduled Events

```yaml
source: CALENDLY
target: MY_POSTGRES

defaults:
  mode: full-refresh
  object: calendly.{stream_name}

streams:
  event_types:
  scheduled_events:
```

If you are facing issues connecting, please reach out to us at <support@slingdata.io>, on [discord](https://discord.gg/q5xtaSNDvp) or open a Github Issue [here](https://github.com/slingdata-io/sling-cli/issues).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.slingdata.io/connections/api-connections/calendly.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
