Prompt Chain

Collect Human Feedback via Slack

A Promptfoo example collecting human feedback via Slack to compare against AI responses, using Promptfoo's slack provider.

Works with slack

75
Spark score
out of 100
Updated 9 days ago
Version 0.121.19
Models

Add to Favorites

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

01

Send AI responses to Slack for review.

02

Collect human feedback on AI outputs.

03

Classify feedback for analysis.

04

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

01
Install the Slack Web API
02
Create a Slack App
03
Add Bot Token Scopes
04
Install to Workspace
05
Set Environment Variable
06
Invite Bot to Channel
07
Initialize the Example
08
Update Channel ID Configuration
09
Run Evaluation
10
Find Your Channel ID

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

  1. Install the Slack Web API (optional dependency):

    npm install @slack/web-api@^8
    

    Slack Web API v8 requires Node.js 20 or newer and supports HTTP_PROXY, HTTPS_PROXY, and NO_PROXY through Promptfoo's Slack provider.

  2. 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
  3. Add Bot Token Scopes:

    • Go to "OAuth & Permissions"
    • Under "Bot Token Scopes", add:
      • chat:write
      • channels:history
      • channels:read
      • groups:history
      • groups:read
      • im:history
      • im:read
  4. Install to Workspace:

    • Click "Install to Workspace"
    • Copy the Bot User OAuth Token (starts with xoxb-)
  5. Set Environment Variable:

    export SLACK_BOT_TOKEN=xoxb-your-token-here
    
  6. Invite 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:

  1. The AI model generates responses
  2. The Slack provider posts prompts to your channel
  3. Humans respond in Slack
  4. Results are collected and compared

Finding Your Channel ID

In Slack:

  1. Click the channel name at the top
  2. Click "About" tab
  3. 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.