Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.auvy.ai/llms.txt

Use this file to discover all available pages before exploring further.

Connect SDK

@auvy-synapse/connect-client is the typed HTTP SDK for Connect — OAuth integrations, tools, and credentials on a separate service from the Synapse API. Synapse routes under /v1/integrations return 410; call Connect directly. This page covers the public browser API only (~7 methods). Triggers, credentials, OAuth apps, and admin CRUD live on Connect advanced.

Install

npm install @auvy-synapse/connect-client @auvy-synapse/client
Peer @auvy-synapse/client supplies transport and auth headers. For workers running tools server-side, see connectRunTool on SDK surfaces (@auvy-synapse/connect-client/server).

Flow 1 — Browse

Story: Show available integrations in a catalog picker.
import { connectFromSession } from '@auvy-synapse/connect-client'

const connect = connectFromSession({
  getAccessToken: () => session.access_token,
})

const integrations = await connect.list({ limit: 50 })
const slack = await connect.get(integrations[0].id)
MethodPurpose
connectFromSession()Factory — publishable key + JWT (see auth note below)
list()Workspace integration catalog
get(id)One integration row
Auth: Browser Connect calls need a publishable key (NUXT_PUBLIC_AUVY_PUBLISHABLE_KEY or publishableKey) and getAccessToken returning the signed-in user JWT. Connect base URL comes from AUVY_CONNECT_URL / NUXT_PUBLIC_AUVY_CONNECT_URL or baseUrl.

Story: Connect Slack (or another provider) for the current user.
const { redirectUrl, connectionRequestId } = await connect.link(integrationId, {
  callbackUrl: 'https://app.example.com/connect/callback',
})

window.location.href = redirectUrl

// After redirect back with OAuth query params:
const { connected, connectedAccountId } = await connect.completeLink(integrationId, {
  connectionRequestId,
  query: Object.fromEntries(new URLSearchParams(window.location.search)),
})
MethodPurpose
link(id, { callbackUrl? })Start OAuth — returns redirectUrl + connectionRequestId
completeLink(id, { connectionRequestId, query? })Finish OAuth after callback
Store connectionRequestId from link() until the user returns; pass it to completeLink() with provider query params.

Flow 3 — Use

Story: Check connection status and list tools before invoking from an agent.
const status = await connect.status(integrationId)
if (!status.connected) {
  // prompt Flow 2
}

const tools = await connect.tools(integrationId)
console.log(tools.map((t) => t.slug))

// Disconnect when the user opts out:
await connect.unlink(integrationId)
MethodPurpose
status(id)Is this integration connected for the current user?
tools(id)Tools exposed by the integration
unlink(id)Disconnect the current user

Advanced surface

Need triggers, credentials, Microsoft multi-connect, or integration CRUD? Use connect.advanced (full IntegrationsClient) or import from @auvy-synapse/connect-client/advanced. See Connect advanced.

Errors

import { ConnectError, CONNECT_ERROR_CODES } from '@auvy-synapse/connect-client'

try {
  await connect.get(integrationId)
} catch (e) {
  if (e instanceof ConnectError && e.code === CONNECT_ERROR_CODES.AUTH_REQUIRED) {
    // re-auth
  }
}
Full error matrix: SDK errors.