Skip to main content
Creates a new calendar connection using OAuth 2.0 credentials. This establishes a connection to either Google Calendar or Microsoft Outlook for syncing calendar events.

Method Signature

await client.calendar.create(params: CreateCalendarParams): Promise<CreateCalendarResponse>

Parameters

platform
CalendarPlatform
required
The calendar platform to connect to. Must be either google_calendar or microsoft_outlook.
oauth_client_id
string
required
The OAuth 2.0 client ID for your application. Obtain this from the Google Cloud Console or Azure portal.
oauth_client_secret
string
required
The OAuth 2.0 client secret for your application.
oauth_refresh_token
string
required
The OAuth 2.0 refresh token obtained after user authorization. This allows the SDK to maintain access to the calendar.
oauth_email
string
The email address associated with the calendar account. Optional but recommended for identifying the connection.

Response

platform
CalendarPlatform
The calendar platform that was connected.
oauth_email
string
The email address associated with the calendar account.
oauth_client_id
string
The OAuth client ID used for the connection (optional in response).
oauth_client_secret
string
The OAuth client secret (optional in response).
oauth_refresh_token
string
The OAuth refresh token (optional in response).

Example

Google Calendar

import { RecallClient } from '@recall-ai/sdk';

const client = new RecallClient({
  apiKey: 'your-api-key'
});

const calendar = await client.calendar.create({
  platform: 'google_calendar',
  oauth_client_id: '123456789.apps.googleusercontent.com',
  oauth_client_secret: 'GOCSPX-abc123def456',
  oauth_refresh_token: '1//0abcdefg-hijklmnop',
  oauth_email: '[email protected]'
});

console.log('Calendar connected:', calendar.oauth_email);

Microsoft Outlook

import { RecallClient } from '@recall-ai/sdk';

const client = new RecallClient({
  apiKey: 'your-api-key'
});

const calendar = await client.calendar.create({
  platform: 'microsoft_outlook',
  oauth_client_id: 'a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6',
  oauth_client_secret: 'secret123~ABC.xyz789',
  oauth_refresh_token: '0.AXEA...',
  oauth_email: '[email protected]'
});

console.log('Calendar connected:', calendar.oauth_email);

Error Handling

try {
  const calendar = await client.calendar.create({
    platform: 'google_calendar',
    oauth_client_id: 'your-client-id',
    oauth_client_secret: 'your-client-secret',
    oauth_refresh_token: 'your-refresh-token'
  });
  console.log('Success:', calendar);
} catch (error) {
  console.error('Failed to create calendar:', error.message);
}

Notes

  • The OAuth credentials must be valid and properly authorized by the user
  • The refresh token should have the necessary scopes to access calendar data
  • For Google Calendar, ensure the Google Calendar API is enabled in your Google Cloud project
  • For Microsoft Outlook, ensure your Azure app has the appropriate Microsoft Graph calendar permissions

Build docs developers (and LLMs) love