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.
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.
The hosted connect flow has three steps: create a token, open the connect page, and retrieve the session result.
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 userconst { endUser } = await client.endUsers.create({ workspaceId: '550e8400-e29b-41d4-a716-446655440000', externalId: 'user_456', displayName: 'Alice Johnson',})// Generate a connect URL for Slackconst { connectUrl } = await client.endUsers.createConnectToken( endUser.id, { integrationName: 'slack' })// Open connectUrl in a popup for the user to authorize
python
# Register the end userresult = client.end_users.create( workspace_id="550e8400-e29b-41d4-a716-446655440000", external_id="user_456", display_name="Alice Johnson",)end_user = result["endUser"]# Generate a connect URL for Slackresult = client.end_users.create_connect_token( end_user["id"], integration_name="slack",)connect_url = result["connectUrl"]# Open connect_url in a popup for the user to authorize
import httpxheaders = {"Authorization": "Bearer wvz_your_key"}# Register the end userres = httpx.post( "https://api.weavz.io/api/v1/end-users", headers=headers, json={ "workspaceId": "550e8400-e29b-41d4-a716-446655440000", "externalId": "user_456", "displayName": "Alice Johnson", },)end_user = res.json()["endUser"]# Generate a connect URL for Slackres = httpx.post( f"https://api.weavz.io/api/v1/end-users/{end_user['id']}/connect-token", headers=headers, json={"integrationName": "slack"},)connect_url = res.json()["connectUrl"]
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:
Connection external IDs are your stable identifiers for individual credential sets. Use them when your backend needs to retrieve or execute against a specific connection, such as a project API key, shared customer bot, or tenant-level account.
For per-user credentials, use end users instead: store your user's ID in endUser.externalId and pass that value as endUserId during execution.
When resolving by connection external ID, always pass the same context you used when creating or using the connection. workspaceId is required for resolution, and mismatched scope is rejected.
typescript
// Create a connection with an external IDawait client.connections.create({ type: 'SECRET_TEXT', integrationName: 'openai', workspaceId: '550e8400-e29b-41d4-a716-446655440000', externalId: 'conn_project_alpha_openai', displayName: 'Project Alpha OpenAI Key', secretText: 'sk-...',})// Later, resolve the connection by external IDconst { connection } = await client.connections.resolve({ integrationName: 'openai', workspaceId: '550e8400-e29b-41d4-a716-446655440000', externalId: 'conn_project_alpha_openai',})
python
# Create a connection with an external IDclient.connections.create( type="SECRET_TEXT", integration_name="openai", workspace_id="550e8400-e29b-41d4-a716-446655440000", external_id="conn_project_alpha_openai", display_name="Project Alpha OpenAI Key", secret_text="sk-...",)# Later, resolve the connection by external IDresult = client.connections.resolve( integration_name="openai", workspace_id="550e8400-e29b-41d4-a716-446655440000", external_id="conn_project_alpha_openai",)