Collect Human Feedback via Slack
A Promptfoo example collecting human feedback via Slack to compare against AI responses, using Promptfoo's slack provider.
Why it matters
Streamline AI response evaluation by collecting human feedback directly through Slack. Automate the process of gathering insights to improve AI model performance.
Outcomes
What it gets done
Send AI responses to Slack for review.
Collect human feedback on AI outputs.
Classify feedback for analysis.
Integrate with Slack for seamless communication.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/pfoo-integration-slack | bash Steps
Steps in the chain
Overview
Integration Slack
A Promptfoo example collecting human feedback via Slack to compare against AI responses, using Promptfoo's slack provider alongside a standard AI provider. Use it to compare an AI model's responses against human judgment collected in Slack. Requires a Slack App with specific bot token scopes.
What it does
An example collecting human feedback via Slack to evaluate AI responses - posting a prompt to a Slack channel via Promptfoo's slack provider alongside an AI provider, so a human's Slack reply becomes a comparison point.
When to use - and when NOT to
Use it when you want to compare an AI model's responses against real human judgment collected directly in Slack, rather than relying solely on automated grading. It requires creating a Slack App with specific Bot Token Scopes (chat:write, channels:history, channels:read, groups:history, groups:read, im:history, im:read), installing it to your workspace, and inviting the bot to your test channel.
Inputs and outputs
Setup: install the optional @slack/web-api@^8 dependency (requires Node.js 20+, and supports HTTP_PROXY/HTTPS_PROXY/NO_PROXY through Promptfoo's Slack provider), create a Slack App, add the bot scopes above, install to your workspace and copy the Bot User OAuth Token (starts with xoxb-), set it as SLACK_BOT_TOKEN, and invite the bot with /invite @your-bot-name. Configure providers to compare an AI model against Slack:
providers:
- openai:gpt-4o-mini # AI model
- slack:C_YOUR_CHANNEL_ID # Human feedback
At eval time: the AI model generates responses, the Slack provider posts prompts to your channel, humans respond in Slack, and results are collected and compared. Find your channel ID via the channel name, then the About tab, then Channel ID at the bottom.
Integrations
Uses the optional @slack/web-api package as Promptfoo's Slack provider, run alongside any standard AI provider (the example uses openai:gpt-4o-mini) in the same providers list. More advanced configuration - specific user feedback, timeout settings - is covered in Promptfoo's Slack provider documentation.
Who it's for
Teams that want a human-in-the-loop comparison point for AI responses - collected asynchronously via Slack - rather than relying purely on automated LLM-as-judge grading.
Source README
integration-slack (Slack Integration)
This example shows how to collect human feedback via Slack for evaluating AI responses.
Prerequisites
Install the Slack Web API (optional dependency):
npm install @slack/web-api@^8Slack Web API v8 requires Node.js 20 or newer and supports
HTTP_PROXY,HTTPS_PROXY, andNO_PROXYthrough Promptfoo's Slack provider.Create a Slack App:
- Go to https://api.slack.com/apps
- Click "Create New App" → "From scratch"
- Give it a name (e.g., "Promptfoo Evaluator")
- Select your workspace
Add Bot Token Scopes:
- Go to "OAuth & Permissions"
- Under "Bot Token Scopes", add:
chat:writechannels:historychannels:readgroups:historygroups:readim:historyim:read
Install to Workspace:
- Click "Install to Workspace"
- Copy the Bot User OAuth Token (starts with
xoxb-)
Set Environment Variable:
export SLACK_BOT_TOKEN=xoxb-your-token-hereInvite Bot to Channel:
- In Slack, go to your test channel
- Type
/invite @your-bot-name
Running the Example
You can run this example with:
npx promptfoo@latest init --example integration-slack
cd integration-slack
Then update the channel ID in promptfooconfig.yaml and run:
npx promptfoo@latest eval
Configuration
The example compares AI responses with human feedback:
providers:
- openai:gpt-4o-mini # AI model
- slack:C_YOUR_CHANNEL_ID # Human feedback
When you run the evaluation:
- The AI model generates responses
- The Slack provider posts prompts to your channel
- Humans respond in Slack
- Results are collected and compared
Finding Your Channel ID
In Slack:
- Click the channel name at the top
- Click "About" tab
- Look for "Channel ID" at the bottom
Advanced Usage
For more advanced configurations (specific user feedback, timeout settings, etc.), see the Slack provider documentation.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.