Quickstart
Give an agent your Slack account and have it post a message.
You need a Dexby account and an OpenAI API key.
Get an API key
Sign up and create a project. Then open the dashboard, go to
Configure → API keys, and create a key. It starts with dx_ and is shown once.
export DEXBY_API_KEY=dx_...
export DEXBY_API_URL=https://api.dexby.ai
export OPENAI_API_KEY=sk-...
bun add @dexby.ai/sdk ai @ai-sdk/openaiConnect Slack for a user
In the dashboard, open Build → Catalog, pick Slack, click Add auth config, and save it.
Then open Build → Auth configs, click Connect account on the Slack config, enter user_123
as the End user identifier, and sign in to Slack.
user_123 stands for one of your own users. In production, use your own user id and let users
connect their accounts themselves with a connect link.
Run the agent
import { openai } from '@ai-sdk/openai'
import { Dexby } from '@dexby.ai/sdk'
import { AiSdkProvider } from '@dexby.ai/sdk/providers/ai-sdk'
import { generateText, stepCountIs } from 'ai'
const dexby = new Dexby({ provider: new AiSdkProvider() })
const tools = await dexby
.createSession({ userId: 'user_123', connectors: ['slack'] })
.andThen((session) => session.tools())
if (tools.isErr()) throw new Error(tools.error.message)
const { text } = await generateText({
model: openai('gpt-5'),
tools: tools.value,
stopWhen: stepCountIs(8),
prompt: 'Post "Deploy finished" to #general'
})
console.log(text)bun agent.tsThe message appears in #general, and the call shows up in the dashboard under
Operate → Logs.
What happened
createSessionscoped the agent to Slack anduser_123's connected accounts.session.tools()gave the model Dexby's tools to search Slack's tools and run one.- The model found
slack_post_messageand ran it. Dexby useduser_123's Slack account.
If user_123 has not connected Slack, the tool tells the model so, and the model answers with that
instead of posting.