SDK reference · Resources
client.connections
client.connections.{ list, createLink, connectToken, revoke }A connection is one of a user's accounts, such as their Gmail or GitHub. Jobs use a connection only when it's passed in connection_ids. Google accounts connect through a connect link; GitHub, Slack and Figma take a token.
list
list(userId: string): Promise<Page<Connection>>The user's connections, including revoked ones.
Parameters
userIdstring- The user's ID.
Returns Promise<Page<Connection>>
createLink
createLink(userId: string, input: { provider: "google" | "gmail" | "drive" | "calendar"; return_url: string }): Promise<ConnectLink>A 30-minute, single-use link that sends the user through Google sign-in and back to return_url with status=connected, connection_id, and connection_ids and services listing every connection made (or status=cancelled, failed, expired or used).
Parameters
userIdstring- Who is connecting.
input.provider"google" | "gmail" | "drive" | "calendar"- The Google service, or "google" for Gmail and Calendar in one sign-in.
input.return_urlstring- Where the user lands afterwards: https, or http on localhost.
Returns Promise<ConnectLink>
const link = await client.connections.createLink(user.id, {
provider: "gmail",
return_url: "https://your-app.example/settings/integrations",
});
// Redirect the user to link.url.connectToken
connectToken(provider: "github" | "slack" | "figma", input: { user_id: string; token: string }): Promise<Connection>Stores a user's GitHub, Slack or Figma token after checking which account it belongs to.
Parameters
provider"github" | "slack" | "figma"- The service.
input.user_idstring- Whose account it is.
input.tokenstring- A personal access token or bot token with the scopes the integration lists.
Returns Promise<Connection>
revoke
revoke(userId: string, connectionId: string): Promise<Connection>Deletes the stored credential; jobs can no longer use the account.
Parameters
userIdstring- The user's ID.
connectionIdstring- The connection's ID (con_…).
Returns Promise<Connection>