Search.../

updateSyncConfig( )

Developer Preview

Updates the specified external calendar connection's sync configuration.

Description

Use Update Sync Config to update a connection's syncConfig property. The syncConfig property contains settings for enabling, configuring, or disabling functionality, including:

  • Importing events from one or more specified calendars in the connected external calendar account. If this is enabled, use listEvents() to retrieve a list of events from the external calendar.
  • Exporting events from the Wix site's calendar to an external calendar.

To see an external calendar connection's existing sync configuration, use getConnection() or listConnections() and see the syncConfig property.

Note: Supported functionality depends on the provider. Use listProviders() to see details about providers' supported features.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function updateSyncConfig(connectionId: string, syncConfig: ConnectionSyncConfig): Promise<UpdateSyncConfigResponse>

updateSyncConfig Parameters

NAME
TYPE
DESCRIPTION
connectionId
string

ID of the external calendar connection to update.

syncConfig
ConnectionSyncConfig

Updated sync configuration details.

Returns

Return Type:

Promise<
UpdateSyncConfigResponse
>
NAME
TYPE
DESCRIPTION
connection
Connection

Connection with updated sync configuration.

Was this helpful?

Update connection to list events from specific external account calendars

Copy Code
1import {externalCalendars} from 'wix-bookings.v2';
2
3async function updateSyncConfig(connectionId) {
4 const syncConfig = {
5 listEventFromCalendars: {
6 enabled: true,
7 calendars: {
8 calendars: [
9 {
10 id: 'a68yu6lp6584z66zorp19z1ab'
11 },
12 {
13 id: '4xve0tohyhnrlzy3lp4zf7b07'
14 }
15 ]
16 }
17 }
18 }
19 const {connection: updatedConnection} =
20 await externalCalendars.updateSyncConfig(connectionId, syncConfig)
21 return updatedConnection
22}
Update connection to sync events to a new dedicated external account calendar

Copy Code
1import {externalCalendars} from 'wix-bookings.v2';
2
3async function updateSyncConfig(connectionId) {
4 const syncConfig = {
5 syncToCalendar: {
6 enabled: true,
7 dedicatedCalendar: {}
8 }
9 }
10 const {connection: updatedConnection} =
11 await externalCalendars.updateSyncConfig(connectionId, syncConfig)
12 return updatedConnection
13}