eavz

Setting Up Connections

Connect third-party services to Weavz using OAuth2, API keys, or custom authentication.

Connections store the authentication credentials needed to interact with third-party services. Weavz supports OAuth2, API key, and custom authentication methods.

Connection Types

TypeUse CaseExample
OAUTH2OAuth2 authorization flowGoogle, Slack, GitHub
PLATFORM_OAUTH2Platform-managed OAuth2 (pre-configured)Slack, Notion, Airtable
SECRET_TEXTSingle API key or tokenOpenAI, Anthropic, SendGrid
BASIC_AUTHUsername and passwordSMTP, legacy APIs
CUSTOM_AUTHMulti-field authenticationCustom services

OAuth2 Connections

OAuth2 connections use the hosted connect flow — a Weavz-hosted page that handles the full authorization process. You create a connect token, open the connect page (as a popup or redirect), and the user completes authorization there. Once finished, you retrieve the session to get the resulting connection.

1

Navigate to Connections

Open the Connections page from the sidebar.

2

Create Connection

Click Create Connection and select the integration (e.g., Slack) from the picker.

3

Authorize

Click Authorize — a popup opens with the provider's consent screen.

4

Approve Access

Approve access in the popup — it closes automatically and your connection appears in the list.

API Key Connections

For services that use API keys or tokens:

1

Navigate to Connections

Open the Connections page from the sidebar.

2

Create Connection

Click Create Connection and select the integration (e.g., OpenAI).

3

Enter Credentials

Enter your API key in the form.

4

Save

Optionally set a display name and external ID, then click Save.

Custom Auth Connections

For integrations requiring multiple fields:

1

Navigate to Connections

Open the Connections page from the sidebar.

2

Create Connection

Click Create Connection and select the integration (e.g., Freshsales).

3

Fill in Fields

The form dynamically renders the required fields for the integration. Fill in all required values (e.g., base URL and API key).

4

Save

Set a display name and external ID, then click Save.

End User Connections

For multi-tenant applications, use end users to manage per-user connections. Register an end user, then generate a connect URL for them:

typescript
// Register the end user
const { endUser } = await client.endUsers.create({
  workspaceId: 'proj_abc123',
  externalId: 'user_456',
  displayName: 'Alice Johnson',
})
 
// Generate a connect URL for Slack
const { connectUrl } = await client.endUsers.createConnectToken(
  endUser.id,
  { integrationName: 'slack' }
)
 
// Open connectUrl in a popup for the user to authorize

Connections created through the end user connect portal are automatically linked to the end user. When executing actions, pass endUserId to resolve the end user's connection:

typescript
const result = await client.actions.execute('slack', 'send_channel_message', {
  workspaceId: 'proj_abc123',
  endUserId: 'user_456',
  input: { channel: 'C0123456789', text: 'Hello!' },
})

See Managing End Users for the full workflow.

External IDs

External IDs are your identifiers for connections, used for multi-tenant applications. They let you map connections to your users or tenants.

When resolving by external ID in multi-tenant setups, always pass the same context you used when creating/using the connection (workspaceId, and endUserId for user-scoped credentials). Mismatched scope is rejected.

typescript
// Create a connection with an external ID
await client.connections.create({
  type: 'SECRET_TEXT',
  integrationName: 'openai',
  externalId: 'user_456',  // Your user's ID
  displayName: 'User 456 OpenAI Key',
  secretText: 'sk-...',
})
 
// Later, resolve the connection by external ID
const { connection } = await client.connections.resolve({
  integrationName: 'openai',
  externalId: 'user_456',
})

Token Refresh

OAuth2 tokens are automatically refreshed when needed — no manual intervention required.

Listing Connections

bash
curl https://api.weavz.io/api/v1/connections \
  -H "Authorization: Bearer wvz_your_key"

Deleting Connections

bash
curl -X DELETE https://api.weavz.io/api/v1/connections/conn_abc123 \
  -H "Authorization: Bearer wvz_your_key"