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
The calendar platform to connect to. Must be either google_calendar or microsoft_outlook.
The OAuth 2.0 client ID for your application. Obtain this from the Google Cloud Console or Azure portal.
The OAuth 2.0 client secret for your application.
The OAuth 2.0 refresh token obtained after user authorization. This allows the SDK to maintain access to the calendar.
The email address associated with the calendar account. Optional but recommended for identifying the connection.
Response
The calendar platform that was connected.
The email address associated with the calendar account.
The OAuth client ID used for the connection (optional in response).
The OAuth client secret (optional in response).
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