A Slack bot that answers data questions via Luzmo's hosted /AIPrompt API (agent: analyst), streams progress updates into Slack, and uploads chart PNGs when Luzmo returns a visualization.



A Slack bot that answers data questions via Luzmo's hosted /AIPrompt API (agent: analyst), streams progress updates into Slack, and uploads chart PNGs when Luzmo returns a visualization.
agent: analyst)users.json)npm install
.env.example to .env and fill in your values:cp .env.example .env
users.json.example to users.json and add authorized users:cp users.json.example users.json
# Development (with hot reload)
npm run dev
# Production
npm run build && npm start
Go to api.slack.com/apps and create a new app
Under Socket Mode, enable it and generate an App-Level Token with connections:write scope — this is your SLACK_APP_TOKEN (xapp-...)
Under OAuth & Permissions, add these Bot Token Scopes:
app_mentions:read — to respond when mentionedchat:write — to send and update messagesfiles:write — to upload chart PNGsim:history — to read DMsim:read — to see DM channelsusers:read — to look up user profilesusers:read.email — to read user emails for permission checksUnder Event Subscriptions, enable events and subscribe to:
app_mention — bot is mentioned in a channelmessage.im — DM sent to the botUnder App Home:
This fixes the Slack message “Sending messages to this app has been turned off.” for DMs.
Install the app to your workspace — the Bot User OAuth Token is your SLACK_BOT_TOKEN (xoxb-...)
| Variable | Required | Description |
|---|---|---|
SLACK_BOT_TOKEN |
Yes | Bot User OAuth Token (xoxb-...) |
SLACK_APP_TOKEN |
Yes | App-Level Token (xapp-...) |
DATASET_IDS |
Yes | Comma-separated dataset IDs pinned on each /AIPrompt call |
LUZMO_HOST |
No | Luzmo API host (defaults to https://api.luzmo.com) |
AIPROMPT_USE_EMBED_AUTH |
No | When true (default), mint scoped embed tokens per user for /AIPrompt |
users.json)Each authorized user is mapped by email to their Luzmo API credentials:
{
"alice@company.com": {
"luzmoKey": "your-luzmo-api-key",
"luzmoToken": "your-luzmo-api-token"
}
}
Org credentials are used to mint embed tokens (when enabled) and to call the Luzmo Export API for chart PNGs. They are never sent to Slack clients.
Only users whose Slack email appears in this file can use the bot. Unauthorized users receive a permission denied message.
@Analyst Bot What are the top categories by revenue?What are the top categories by revenue?The bot will:
users.jsonPOST /0.1.0/aiprompt with agent: analyst and stream progress + textFollow-up messages in the same Slack thread continue the Luzmo conversation_id automatically.
Slack → message-handler → aiprompt-client → Luzmo /AIPrompt
→ chart-renderer → Slack
See createAIPrompt.md for the API reference.
Take your data products to the next level with Luzmo.