@kashew/calendly-v2-sdk

Library to give developers a pleasurable integration experience with Calendly's v2 API. For more information about Calendly v2 API, please visit Calendly's Developer Portal.

Usage no npm install needed!

<script type="module">
  import kashewCalendlyV2Sdk from 'https://cdn.skypack.dev/@kashew/calendly-v2-sdk';
</script>

README

Calendly V2 SDK

Library to give developers a pleasurable integration experience with Calendly's v2 API. For more information about Calendly v2 API, please visit Calendly's Developer Portal.

Buy Me A Coffee

Installation

npm i -S @kashew/calendly-v2-sdk

Usage

For every resource offered by Calendly's v2 API, there exists a client for accessing that resource:

import {
  OAuthClient,
  EventTypesClient,
  OrganizationInvitationsClient,
  OrganizationMembershipsClient,
  ScheduledEventsClient,
  ScheduledEventInviteesClient,
  SchedulingLinksClient,
  UsersClient,
  WebhookPayloadClient,
  WebhookSubscriptionsClient
} from '@kashew/calendly-v2-sdk'

OAuthClient

Client used for making various calls concerning OAuth.

This client cannot handle the various front-end calls that needs to happen in order to get a code, but once you have a code, this client can handle the exchange for an access token along with subsequent refresh calls.

More details about this client can be found on the Wiki page:
Wiki - OAuthClient

Parameters

  • clientId (string) - Client ID provided by Calendly
  • clientSecret (string) - Client Secret provided by Calendly

Example Usage

/**
 * Your Client ID and Client Secret are unique to you and should have been
 * provided when you requested access to Calendly's v2 API.
 */
const clientId = '<my_client_id>'
const clientSecret = '<my_client_secret>'

const client = new OAuthClient(clientId, clientSecret)

Method Signatures

async token(options: TokenOptions) : Promise<Token>

Calendly's v2 API Documentation: Get Access Token


async introspect(token: string): Promise<IntrospectResponse>

Calendly's v2 API Documentation: Introspect Access/Refresh Token


async revoke(token: string): Promise<void>

Calendly's v2 API Documentation: Revoke Access/Refresh Token


EventTypesClient

Client used for accessing Event Type resource data

More details about this client can be found on the Wiki page:
Wiki - EventTypesClient

Parameters

  • token (Token) - Access Token that can be retrieved using the OAuthClient

Example Usage

const oauthClient = new OAuthClient(clientId, clientSecret)
const token = oauthClient.token({...})

const client = new EventTypesClient(token)

Method Signatures

async get(uuid: string): Promise<EventType>

Calendly's v2 API Documentation: Get Event Type


async list(options: EventTypeOptions): Promise<EventTypeList>

Calendly's v2 API Documentation: List Event Types


OrganizationInvitationsClient

Client used for accessing Organization Invitation resource data

More details about this client can be found on the Wiki page:
Wiki - OrganizationInvitationsClient

Parameters

  • token (Token) - Access Token that can be retrieved using the OAuthClient
  • organizationUuid - UUID of the Organization

Example Usage

const oauthClient = new OAuthClient(clientId, clientSecret)
const token = oauthClient.token({...})

const organizationUuid = '<organization_uuid>'

const client = new OrganizationInvitationsClient(token, organizationUuid)

Method Signatures

async create(options: OrganizationInvitationCreateOptions): Promise<OrganizationInvitation>

Calendly's v2 API Documentation: Invite User to Organization


async delete(uuid: string): Promise<void>

Calendly's v2 API Documentation: Revoke User's Organization Invitation


async get(uuid: string): Promise<OrganizationInvitation>

Calendly's v2 API Documentation: Get Organization Invitation


async list(options: OrganizationInvitationOptions = {}): Promise<OrganizationInvitationList>

Calendly's v2 API Documentation: List Organization Invitations


OrganizationMembershipsClient

Client used for accessing Organization Membership resource data

More details about this client can be found on the Wiki page:
Wiki - OrganizationMembershipsClient

Parameters

  • token (Token) - Access Token that can be retrieved using the OAuthClient

Example Usage

const oauthClient = new OAuthClient(clientId, clientSecret)
const token = oauthClient.token({...})

const client = new OrganizationMembershipsClient(token)

Method Signatures

async delete(uuid: string): Promise<void>

Calendly's v2 API Documentation: Remove User from Organization


async get(uuid: string): Promise<OrganizationMembership>

Calendly's v2 API Documentation: Get Organization Membership


async list(options: OrganizationMembershipOptions): Promise<OrganizationMembershipList>

Calendly's v2 API Documentation: List Organization Memberships


ScheduledEventsClient

Client used for accessing Scheduled Event resource data

More details about this client can be found on the Wiki page:
Wiki - ScheduledEventsClient

Parameters

  • token (Token) - Access Token that can be retrieved using the OAuthClient

Example Usage

const oauthClient = new OAuthClient(clientId, clientSecret)
const token = oauthClient.token({...})

const client = new ScheduledEventsClient(token)

Method Signatures

async get(uuid: string): Promise<ScheduledEvent>

Calendly's v2 API Documentation: Get Event


async list(options: ScheduledEventOptions): Promise<ScheduledEventList>

Calendly's v2 API Documentation: List Events


ScheduledEventInviteesClient

Client used for accessing a Scheduled Event's Invitee resource data

More details about this client can be found on the Wiki page:
Wiki - ScheduledEventInviteesClient

Parameters

  • token (Token) - Access Token that can be retrieved using the OAuthClient
  • scheduledEventUuid (string) - UUID of Scheduled Event

Example Usage

const oauthClient = new OAuthClient(clientId, clientSecret)
const token = oauthClient.token({...})

const scheduledEventUuid = '<scheduled_event_uuid>'

const client = new ScheduledEventInviteesClient(token, scheduledEventUuid)

Method Signatures

async get(uuid: string): Promise<Invitee>

Calendly's v2 API Documentation: Get Event Invitee


async list(options: InviteeOptions = {}): Promise<InviteeList>

Calendly's v2 API Documentation: List Event Invitees


SchedulingLinksClient

Client used for accessing Scheduling Link resource data

More details about this client can be found on the Wiki page:
Wiki - SchedulingLinksClient

Parameters

  • token (Token) - Access Token that can be retrieved using the OAuthClient

Example Usage

const oauthClient = new OAuthClient(clientId, clientSecret)
const token = oauthClient.token({...})

const client = new SchedulingLinksClient(token)

Method Signatures

async create(options: SchedulingLinkCreateOptions): Promise<SchedulingLink>

Calendly's v2 API Documentation: Create Scheduling Link


UsersClient

Client used for accessing User resource data

More details about this client can be found on the Wiki page:
Wiki - UsersClient

Parameters

  • token (Token) - Access Token that can be retrieved using the OAuthClient

Example Usage

const oauthClient = new OAuthClient(clientId, clientSecret)
const token = oauthClient.token({...})

const client = new UsersClient(token)

Method Signatures

async get(uuid: string): Promise<User>

Calendly's v2 API Documentation: Get User


async me(): Promise<User>

Calendly's v2 API Documentation: Get Current User


WebhookPayloadClient

Client used for accessing Webhook Subscription resource data

More details about this client can be found on the Wiki page:
Wiki - WebhookPayloadClient

Parameters

  • webhookSigningKey (string) - Webhook Signing Key used to validate a webhook signature
  • tolerance (number) - Number of seconds that will be tolerated since the creation of the webhook payload

Example Usage

const webhookSigningKey = 'my_webhook_signing_key'
const tolerance = 180 // (i.e. 3 minutes)

const client = new WebhookPayloadClient(webhookSigningKey, tolerance)

Method Signatures

async verify(webhookSignature: String, message: WebhookPayloadEntity): Promise<void>

Calendly's v2 API Documentation: Verify Webhook Signatures


WebhookSubscriptionsClient

Client used for accessing Webhook Subscription resource data

More details about this client can be found on the Wiki page:
Wiki - WebhookSubscriptionsClient

Parameters

  • token (Token) - Access Token that can be retrieved using the OAuthClient

Example Usage

const oauthClient = new OAuthClient(clientId, clientSecret)
const token = oauthClient.token({...})

const client = new WebhookSubscriptionsClient(token)

Method Signatures

async create(options: WebhookSubscriptionCreateOptions): Promise<WebhookSubscription>

Calendly's v2 API Documentation: Create Webhook Subscription

async delete(uuid: string): Promise<void>

Calendly's v2 API Documentation: Delete Webhook Subscription

async get(uuid: string): Promise<WebhookSubscription>

Calendly's v2 API Documentation: Get Webhook Subscription

async list(options: WebhookSubscriptionOptions): Promise<WebhookSubscriptionList>

Calendly's v2 API Documentation: List Webhook Subscriptions