text
stringlengths
0
59.1k
## 2. Configure environment variables
Copy the env template:
```bash
cp .env.example .env.local
```
Set these values:
```bash
OPENAI_API_KEY=your_openai_api_key
SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_SIGNING_SECRET=your-signing-secret
REDIS_URL=redis://localhost:6379
```
## 3. Create and configure your Slack app
Open [api.slack.com/apps](https://api.slack.com/apps), create a new app, and use this manifest:
```yaml
display_information:
name: VoltAgent Chat SDK Bot
description: Slack bot built with Chat SDK and VoltAgent
features:
bot_user:
display_name: VoltAgentBot
always_online: true
oauth_config:
scopes:
bot:
- app_mentions:read
- channels:history
- channels:read
- chat:write
- groups:history
- groups:read
- im:history
- im:read
- mpim:history
- mpim:read
- reactions:read
- reactions:write
- users:read
settings:
event_subscriptions:
request_url: https://your-domain.com/api/webhooks/slack
bot_events:
- app_mention
- message.channels
- message.groups
- message.im
- message.mpim
interactivity:
is_enabled: true
request_url: https://your-domain.com/api/webhooks/slack
org_deploy_enabled: false
socket_mode_enabled: false
token_rotation_enabled: false
```
Then install the app to your workspace and collect:
- Bot User OAuth Token (`xoxb-...`) -> `SLACK_BOT_TOKEN`
- Signing Secret -> `SLACK_SIGNING_SECRET`
## 4. Run locally and expose webhook URL
Start Next.js:
```bash
pnpm dev
```
Expose local port `3000` with Volt Tunnel:
```bash
pnpm volt tunnel 3000
```
Then update both Slack URLs:
- Event Subscriptions -> Request URL
- Interactivity -> Request URL
Both should point to:
`https://your-tunnel-url/api/webhooks/slack`
## 5. Test the bot
1. Invite the bot to a channel: `/invite @VoltAgentBot`
2. Mention the bot in a channel or thread
3. The bot subscribes to the thread and sends a welcome card
4. Send follow-up messages in that thread and get VoltAgent-generated responses
5. Click the buttons to trigger `hello` and `info` action handlers
## 6. How the example is wired