AbstractStaticMergeMerge scopes from multiple tools, deduplicating.
Arrays of scopes to merge
Deduplicated array of scopes
AbstractgetRetrieves an access token for a channel resource.
Returns the token of the user who enabled sync on the given channel. If the channel is not enabled or the token is expired/invalid, returns null.
The channel resource ID (e.g., calendar ID)
Promise resolving to the access token or null
Retrieves an access token for a channel resource.
The OAuth provider (deprecated, ignored for single-provider connectors)
The channel resource ID (e.g., calendar ID)
Promise resolving to the access token or null
AbstractsaveSaves a link with notes to the connector's focus.
Creates a thread+link pair. The thread is a lightweight container; the link holds the external entity data (source, meta, type, status, etc.).
This method is available only to Connectors (not regular Twists).
The link with notes to save
Promise resolving to the saved thread's UUID, or null if the link was filtered out (e.g. older than the plan's sync history limit)
AbstractsaveBatch version of saveLink — saves many links in one call.
Connectors syncing many items per page (e.g. calendar events, issues,
messages) should prefer this over looping saveLink. Each saveLink
crosses the runtime boundary and counts against the per-execution
request budget; saveLinks collapses N saves into a single crossing.
Failures on individual links DO NOT abort the batch. A bad item lands
as null in its slot and the rest still save. This prevents one
malformed record from losing an entire page of sync progress.
This method is available only to Connectors (not regular Twists).
Array of links with notes to save
Array of the same length and order as links. Each entry is
the saved thread's UUID, or null if the link was filtered out
(e.g. older than the plan's sync history limit) OR failed to save.
The two null causes are not distinguished; the save failure is
logged server-side.
AbstractsaveUpserts contacts into the connector's focus without requiring a Link.
Use this for messaging connectors to bulk-sync workspace members so the
recipient picker can filter contacts by reachable platform account. Populate
NewContact.source to persist contact_external_account rows (the platform
identity used to address the contact). Returns one Actor per input, in order.
Contacts to upsert, keyed by source/key
Promise resolving to the saved actors, 1:1 with input order
AbstractarchiveArchives links matching the given filter that were created by this connector.
For each archived link's thread, if no other non-archived links remain, the thread is also archived.
Filter criteria for which links to archive
Promise that resolves when archiving is complete
AbstractsetSets or clears todo status on a thread owned by this connector.
The link source URL identifying the thread
The user to set the todo for
true to mark as todo, false to clear/complete
Optionaloptions: { date?: string | Date }Additional options
Optionaldate?: string | DateThe todo date (when todo=true). Defaults to today.
AbstractchannelSignal that initial bulk-sync (or recovery sync) for a channel is fully complete. The Flutter app uses this to clear the "syncing…" indicator on the connection.
The framework automatically marks a channel as syncing when it dispatches
onChannelEnabled (whether initial-enable, auto-enable from
setChannels, or recovery after re-auth). Connectors do NOT need to
call anything to start tracking — only to signal completion.
Call this exactly once when the initial backfill has finished (no more pages, all phases exhausted). Do NOT call it on every incremental sync.
If onChannelEnabled throws an unhandled exception, the framework
automatically clears the syncing state — connectors don't need a
try/catch to clear state on failure.
No-op when no auth/user mapping exists for the channel (e.g. key-based connectors that don't have a per-user OAuth association).
The channel resource ID whose initial sync just finished
AbstractmarkFlag a connection as needing re-authentication so the Flutter app surfaces a re-auth prompt on the next sync.
Call this when a connector's API call returns a permanent auth-style
error that the runtime can't observe through token refresh — e.g.
Slack invalid_auth / token_revoked / not_authed, or a 401 on a
provider that doesn't refresh. The runtime already flags reauth
automatically when an OAuth refresh permanently fails or when the
stored token is missing on a get(); only call this for cases the
runtime can't see.
Idempotent: safe to call repeatedly; existing reauth flags are not
overwritten. No-op when the channel has no enabledBy actor (e.g.
key-based connectors).
The channel resource ID whose token is bad
Built-in tool for managing OAuth authentication and channel resources.
The Integrations tool:
Connectors declare their provider, scopes, and channel lifecycle methods as class properties and methods. The Integrations tool reads these automatically. Auth and channel management is handled in the twist edit modal in Flutter.
Example