Intermediate~15 min setupAI & CommunicationVerified April 2026
OpenAI logo
Slack logo

How to build an AI-powered Q&A bot with Pipedream

When someone mentions your bot in Slack, automatically send their question to GPT-4 and post the response as a thread reply.

Steps and UI details are based on platform versions at time of writing — check each platform for the latest interface.

Best for

Teams that need instant AI responses in Slack without switching to ChatGPT tabs or apps

Not ideal for

High-security environments where sending data to external AI models violates compliance rules

Sync type

real-time

Use case type

notification

Real-World Example

💡

A 25-person engineering team uses this to get instant code explanations and debugging help in their #dev-questions channel. Before automation, developers would paste questions into ChatGPT separately, losing context and slowing down troubleshooting. Now they just mention @ai-helper and get GPT-4 responses directly in thread within 3-5 seconds.

What Will This Cost?

Drag the slider to your expected monthly volume.

/mo
505005K50K

Each platform counts differently — Zapier: 1 task per trigger. Make: 1 operation per module per record. n8n: 1 execution per run.

Prices shown for annual billing. Based on published pricing as of April 2026.

Estimated ROI

1000

min saved/mo

$583

labor value/mo

Free

no platform cost

Based on ~2 min manual effort per operation at $35/hr fully loaded labor cost.

Implementation

Skip the setup

Import this workflow directly into Pipedream

Copy the pre-built Pipedream blueprint and paste it straight into Pipedream. All modules, filters, and field mappings are already configured — you just need to connect your accounts.

Before You Start

Make sure you have everything ready.

Slack workspace admin access to create and configure bot users
OpenAI API key with GPT-4 access and billing set up
Pipedream account (free tier supports 100 executions/month)
Bot user created in Slack with appropriate channel permissions

Field Mapping

Map these fields between your apps.

FieldAPI Name
Required
Question Text
Channel ID
Thread Timestamp
User ID
GPT Response
Model Name

Step-by-Step Setup

1

Workflows > + New Workflow

Create new Pipedream workflow

Go to pipedream.com and click the green 'New Workflow' button in the top right. You'll land on the workflow builder with an empty trigger step. This is where you'll configure the Slack mention detection that kicks off your AI bot.

  1. 1Click 'New Workflow' from the dashboard
  2. 2Name your workflow 'AI Q&A Bot'
  3. 3Leave the default trigger step selected
What you should see: You should see the workflow builder with Step 1 highlighted and 'Select an app or event' dropdown ready.
2

Step 1 > Select app > Slack > New Mention

Add Slack mention trigger

Click the trigger dropdown and search for Slack. Select 'New Mention' as your trigger type. This fires every time someone mentions your bot in any channel or DM. You'll need to connect your Slack workspace and choose which bot user to monitor for mentions.

  1. 1Type 'Slack' in the app search box
  2. 2Click 'Slack' from the results
  3. 3Select 'New Mention' trigger type
  4. 4Click 'Connect Account' to authorize Slack
What you should see: A green 'Connected' badge appears next to your Slack workspace name, and you see bot user selection options.
Common mistake — The bot user must be added to channels where you want it to respond - private channels require manual invitation.
Pipedream
+
click +
search apps
OpenAI
OP
OpenAI
Add Slack mention trigger
OpenAI
OP
module added
3

Slack Trigger > Configuration

Configure bot mention settings

Select your bot user from the dropdown - if you don't have one, create it in Slack's app settings first. Set the trigger to fire on mentions in any channel. Test the trigger by mentioning your bot in Slack and clicking 'Generate Test Event' to confirm Pipedream receives the message data.

  1. 1Select your bot user from the 'Bot User' dropdown
  2. 2Leave 'Channel' set to 'Any Channel'
  3. 3Click 'Generate Test Event'
  4. 4Go mention your bot in Slack with a test question
What you should see: You should see sample message data appear showing the mention text, channel ID, user info, and timestamp.
4

Step 2 > + Add Step > OpenAI > Chat

Add GPT-4 processing step

Click the + button below your trigger to add a new step. Search for OpenAI and select it. Choose 'Chat' as the action type since you're sending conversational questions to GPT-4. This step will take the mention text and send it to OpenAI's API.

  1. 1Click the + button below Step 1
  2. 2Search for 'OpenAI' in the app list
  3. 3Select 'Chat' action
  4. 4Click 'Connect Account' and enter your OpenAI API key
What you should see: You see the OpenAI configuration form with model selection and message input fields ready to configure.
Common mistake — You need an OpenAI API key with GPT-4 access - GPT-3.5-turbo is cheaper but less accurate for complex questions.
5

OpenAI Step > Configuration

Configure GPT-4 model settings

Set the model to 'gpt-4' for best results. In the messages array, create a system message that defines your bot's role and a user message containing the actual question. Map the question text from the Slack trigger data using Pipedream's step picker.

  1. 1Select 'gpt-4' from the Model dropdown
  2. 2Set Max Tokens to 500 to control response length
  3. 3Add system message: 'You are a helpful technical assistant'
  4. 4Add user message and map it to steps.trigger.event.text
What you should see: The message configuration shows your system prompt and the dynamic user question mapped from the Slack mention.
Common mistake — GPT-4 costs $0.03 per 1K tokens - monitor usage in high-traffic channels to avoid surprise bills.
6

Between Steps > + Code (Node.js)

Clean up the question text

Add a Code step between Slack and OpenAI to strip out the bot mention from the question. Raw Slack mentions include '@botname' at the start, which you don't want to send to GPT-4. This step extracts just the actual question text using JavaScript string manipulation.

  1. 1Click + between your Slack and OpenAI steps
  2. 2Select 'Code' then 'Run Node.js code'
  3. 3Paste the question parsing code
  4. 4Update the OpenAI step to use this cleaned text
What you should see: The code step shows your question parsing logic, and the OpenAI step now references the cleaned question text.

This code step cleans the question text by removing bot mentions and extracting just the user's actual question. Paste it in a Node.js code step between your Slack trigger and OpenAI step.

JavaScript — Code Stepexport default defineComponent({
▸ Show code
export default defineComponent({
  async run({ steps, $ }) {
    const originalText = steps.trigger.event.text;

... expand to see full code

export default defineComponent({
  async run({ steps, $ }) {
    const originalText = steps.trigger.event.text;
    const botUserId = steps.trigger.event.bot_id || '<@U1234567890>';
    
    // Remove bot mention and clean up the question
    let cleanQuestion = originalText
      .replace(/<@[UW][A-Z0-9]+>/g, '') // Remove all user mentions
      .replace(/^\s+|\s+$/g, '') // Trim whitespace
      .replace(/\s+/g, ' '); // Normalize spaces
    
    // Check if there's actually a question
    if (!cleanQuestion || cleanQuestion.length < 3) {
      cleanQuestion = "Please ask me a specific question and I'll help you find an answer.";
      return {
        question: cleanQuestion,
        shouldRespond: false
      };
    }
    
    // Add context about the channel for better responses
    const channelName = steps.trigger.event.channel_name || 'general';
    const contextualQuestion = `In a ${channelName} channel discussion: ${cleanQuestion}`;
    
    return {
      question: contextualQuestion,
      originalQuestion: cleanQuestion,
      shouldRespond: true,
      channelContext: channelName
    };
  }
});
7

Step 4 > + Add Step > Slack > Send Message to Channel

Add Slack thread reply step

Add another step and select Slack again. Choose 'Send Message to Channel' as the action. Configure it to reply in a thread by setting the thread_ts to the original message timestamp. This keeps the AI response organized under the original question.

  1. 1Click + to add a final step
  2. 2Select Slack > Send Message to Channel
  3. 3Map Channel to steps.trigger.event.channel
  4. 4Map Text to the GPT response from OpenAI step
  5. 5Set Thread TS to steps.trigger.event.ts
What you should see: The Slack reply step shows channel and thread mapping configured to post GPT-4's response as a threaded reply.
Common mistake — Without thread_ts, replies post as new messages instead of organized threads - users lose conversation context.
8

Workflow > Deploy > Test in Slack

Test the complete workflow

Click 'Deploy' to activate your workflow, then test it end-to-end. Go to your Slack workspace and mention your bot with a real question. Watch for the threaded AI response to appear within 5-10 seconds. Check Pipedream's execution logs if anything fails.

  1. 1Click the green 'Deploy' button at the top
  2. 2Go to Slack and mention your bot: '@aibot What is React?'
  3. 3Wait 5-10 seconds for the threaded response
  4. 4Check execution logs in Pipedream if no response appears
What you should see: Your bot posts a GPT-4 generated answer as a threaded reply under your question in Slack.
Common mistake — First deployments can take 30-60 seconds to activate - don't panic if immediate tests fail.
Pipedream
▶ Deploy & test
executed
OpenAI
Slack
Slack
🔔 notification
received

Going live

Production Checklist

Before you turn this on for real, confirm each item.

Troubleshooting

Common errors and how to fix them.

Frequently Asked Questions

Common questions about this workflow.

Analysis

VerdictWhy n8n for this workflow

Use Pipedream for this if you need instant webhook processing and want to customize the AI logic with real code. Unlike Zapier's limited AI actions, you get full control over GPT prompts, response formatting, and error handling. The instant webhook triggers beat Make's 1-minute polling for real-time chat responses. Skip Pipedream if you're on a tight budget - Zapier's AI actions bundle multiple API calls into one task.

Cost

At 100 bot mentions per month, you'll spend $0 on Pipedream (free tier) plus about $3-5 in OpenAI costs for GPT-4. Zapier charges $20/month minimum for AI features, making it 4x more expensive. Make costs $9/month but adds 1-minute delays that kill the chat experience. N8N self-hosted is free but requires server management.

Tradeoffs

Make handles complex conditional logic better with its visual branching system - great if you want different AI models for different question types. Zapier's built-in AI actions are simpler to set up but less flexible than custom OpenAI calls. N8N offers the most customization but requires technical setup. Power Automate integrates well with Microsoft teams but lacks decent Slack triggers. Pipedream wins on the webhook speed and code flexibility that chat bots demand.

You'll hit OpenAI rate limits in active channels - GPT-4 allows 200 requests per minute for paid accounts, but only 3/minute on free tiers. Slack's thread_ts timestamp format is finicky and breaks threaded replies if mapped wrong. The bot will respond to its own messages if you mention other users in responses, creating infinite loops that burn through your API quota fast.

Ideas for what to build next

  • Add conversation memoryStore recent thread history in a database so the bot remembers context from previous messages in the same thread.
  • Create topic-specific botsDeploy separate workflows with specialized system prompts for different channels like #dev-help, #marketing-questions, or #hr-support.
  • Add response moderationUse OpenAI's moderation API to filter inappropriate questions and responses before posting to maintain professional Slack environments.

Related guides

Was this guide helpful?
OpenAI + Slack overviewPipedream profile →