Updates an existing calendar connection’s OAuth credentials, platform, or email. This is useful when refresh tokens expire or need to be rotated.
Method Signature
await client.calendar.update(params: UpdateCalendarParams): Promise<CreateCalendarResponse>
Parameters
The unique identifier of the calendar connection to update.
Update the OAuth 2.0 client ID. Optional - only provide if changing.
Update the OAuth 2.0 client secret. Optional - only provide if changing.
Update the OAuth 2.0 refresh token. Optional - provide this when the token expires or needs rotation.
Update the calendar platform. Can be google_calendar or microsoft_outlook. Optional.
Update the email address associated with the calendar account. Optional.
Response
The updated calendar platform.
The updated email address.
The updated OAuth client ID (optional in response).
The updated OAuth client secret (optional in response).
The updated OAuth refresh token (optional in response).
Examples
Update Refresh Token
import { RecallClient } from '@recall-ai/sdk';
const client = new RecallClient({
apiKey: 'your-api-key'
});
const calendar = await client.calendar.update({
id: 'cal_1234567890abcdef',
oauth_refresh_token: 'new-refresh-token-xyz'
});
console.log('Calendar updated successfully');
Update Email Address
import { RecallClient } from '@recall-ai/sdk';
const client = new RecallClient({
apiKey: 'your-api-key'
});
const calendar = await client.calendar.update({
id: 'cal_1234567890abcdef',
oauth_email: '[email protected]'
});
console.log('Email updated to:', calendar.oauth_email);
Update OAuth Credentials
import { RecallClient } from '@recall-ai/sdk';
const client = new RecallClient({
apiKey: 'your-api-key'
});
const calendar = await client.calendar.update({
id: 'cal_1234567890abcdef',
oauth_client_id: 'new-client-id',
oauth_client_secret: 'new-client-secret',
oauth_refresh_token: 'new-refresh-token'
});
console.log('OAuth credentials updated successfully');
import { RecallClient } from '@recall-ai/sdk';
const client = new RecallClient({
apiKey: 'your-api-key'
});
const calendar = await client.calendar.update({
id: 'cal_1234567890abcdef',
platform: 'microsoft_outlook'
});
console.log('Platform updated to:', calendar.platform);
Refresh Expired Token
import { RecallClient } from '@recall-ai/sdk';
const client = new RecallClient({
apiKey: 'your-api-key'
});
const calendarId = 'cal_1234567890abcdef';
// Check current status
const calendar = await client.calendar.retrieve({ id: calendarId });
if (calendar.status === 'disconnected') {
// Get a new refresh token from your OAuth flow
const newRefreshToken = await getNewRefreshToken(calendar.oauth_email);
// Update the calendar with the new token
await client.calendar.update({
id: calendarId,
oauth_refresh_token: newRefreshToken
});
console.log('Calendar reconnected with new token');
}
Partial Update
import { RecallClient } from '@recall-ai/sdk';
const client = new RecallClient({
apiKey: 'your-api-key'
});
// Only update the fields you need to change
const calendar = await client.calendar.update({
id: 'cal_1234567890abcdef',
oauth_email: '[email protected]'
// Other fields remain unchanged
});
console.log('Partial update completed');
Update with Error Handling
import { RecallClient } from '@recall-ai/sdk';
const client = new RecallClient({
apiKey: 'your-api-key'
});
const calendarId = 'cal_1234567890abcdef';
try {
const calendar = await client.calendar.update({
id: calendarId,
oauth_refresh_token: 'new-refresh-token'
});
console.log('Successfully updated calendar');
} catch (error) {
if (error.status === 404) {
console.error('Calendar not found');
} else if (error.status === 400) {
console.error('Invalid parameters:', error.message);
} else {
console.error('Update failed:', error.message);
}
}
Rotate All Credentials
import { RecallClient } from '@recall-ai/sdk';
const client = new RecallClient({
apiKey: 'your-api-key'
});
const calendarId = 'cal_1234567890abcdef';
// Rotate all OAuth credentials for security
const updatedCalendar = await client.calendar.update({
id: calendarId,
oauth_client_id: 'rotated-client-id',
oauth_client_secret: 'rotated-client-secret',
oauth_refresh_token: 'rotated-refresh-token'
});
console.log('All credentials rotated successfully');
Notes
- All parameters except
id are optional - only provide fields you want to update
- Updating the refresh token is the most common use case when tokens expire
- The calendar connection will attempt to reconnect if it was disconnected
- Invalid OAuth credentials will result in a failed connection status
- Use this method to keep calendar connections active and up-to-date