Run a tool
Call one tool with a user's connected account, or send a raw request to an app's API.
No model needed. Your code picks the tool and its input, and Dexby runs it with the user's account.
import { Dexby } from '@dexby.ai/sdk'
const dexby = new Dexby()
const result = await dexby.tools.execute({
toolId: 'slack_post_message',
userId: 'user_123',
input: { channel: 'general', text: 'Deploy finished' }
})
console.log(result) // a failure throws a DexbyError with its codecurl -X POST "https://api.harryy.ai/v1/tools/execute" \
-H "Authorization: Bearer $DEXBY_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "toolId": "slack_post_message", "userId": "user_123",
"input": { "channel": "general", "text": "Deploy finished" } }'| Field | Default | Meaning |
|---|---|---|
toolId | required | The tool, such as slack_post_message. Find ids in Build → Catalog or with dexby.tools.list({ query: 'slack' }). |
input | {} | Must match the tool's input schema. Build → Playground shows it and builds the input for you. |
userId | required | Your id for the user. A call without one answers VALIDATION_ERROR. |
connectionId | the default | Run with a specific account when the user has several. See Concepts. |
If the user has not connected the app, the call fails with MISSING_CONNECTION. Send them a
connect link. Every other code is in Errors.
Try any tool without code in Build → Playground in the dashboard.
Proxy a raw request
When no tool covers an endpoint, send the request yourself. Dexby adds the user's credential and sends it to the app's API.
const users = await dexby.tools.proxy({
connectorId: 'slack',
userId: 'user_123',
endpoint: '/users.list',
method: 'GET'
})curl -X POST "https://api.harryy.ai/v1/tools/proxy" \
-H "Authorization: Bearer $DEXBY_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "connectorId": "slack", "userId": "user_123", "endpoint": "/users.list", "method": "GET" }'| Field | Default | Meaning |
|---|---|---|
connectorId | required | The app, such as slack. |
userId | required | Your id for the user. |
endpoint | required | Path on the app's API, relative to its base URL. |
method | GET | GET, POST, PUT, PATCH or DELETE. |
query | none | Query string values. |
body | none | JSON body. |
headers | none | Extra headers. The credential is added for you. |
connectionId | default | A specific account. |
Each connector's page in Build → Catalog shows its base URL and a ready proxy example. An agent can
proxy too, through a session with policy.allowProxy.