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

How to Draft Email Responses from Slack Messages with N8n

Paste a client email into a Slack channel and automatically generate a professional response using OpenAI's GPT-4.

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

Best for

Teams that process client emails regularly and want AI-drafted responses with custom formatting.

Not ideal for

One-off email tasks or teams that need instant setup without any coding.

Sync type

real-time

Use case type

notification

Real-World Example

💡

A 12-person marketing agency uses this to draft client email responses in their #client-emails Slack channel. Account managers paste client requests and get AI-generated professional responses within 30 seconds. Before automation, drafting responses took 5-10 minutes per email and junior staff struggled with tone consistency.

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 n8n

Copy the pre-built n8n blueprint and paste it straight into n8n. 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 with admin access to create bot tokens
OpenAI API key with GPT-4 access and available credits
N8n instance running (self-hosted or cloud)
Designated Slack channel for email processing
Team training on how to paste emails in the correct format

Field Mapping

Map these fields between your apps.

FieldAPI Name
Required
Message Texttext
Channel IDchannel
Thread Timestampts
GPT Responsechoices[0].message.content
2 optional fields▸ show
User IDuser
Model Usedmodel

Step-by-Step Setup

1

Dashboard > New Workflow

Create New Workflow

Start a fresh N8n workflow for the email drafting automation. This sets up your canvas for connecting Slack and OpenAI.

  1. 1Click 'New Workflow' in the N8n dashboard
  2. 2Name it 'Email Response Drafter'
  3. 3Click 'Save' to create the workflow
What you should see: You should see a blank workflow canvas with a single 'Start' node.
2

Workflow > Add Node > Triggers > Slack

Add Slack Trigger

Set up a Slack trigger that listens for new messages in your designated channel. This monitors when someone pastes a client email.

  1. 1Click the '+' button to add a node
  2. 2Search for 'Slack' and select 'Slack Trigger'
  3. 3Choose 'On New Message' from the trigger dropdown
  4. 4Select your target channel from the Channel list
What you should see: The Slack trigger node shows green with your channel name displayed.
Common mistake — Don't select 'All Messages' - it'll trigger on bot responses and create loops.
n8n
+
click +
search apps
OpenAI
OP
OpenAI
Add Slack Trigger
OpenAI
OP
module added
3

Slack Node > Credentials > Create New

Connect Slack Credentials

Authenticate N8n with your Slack workspace. You need a bot token with channels:read and channels:history permissions.

  1. 1Click 'Create New' under Credentials
  2. 2Select 'Slack OAuth2 API' from the dropdown
  3. 3Paste your Bot User OAuth Token
  4. 4Click 'Test' then 'Save'
What you should see: Green checkmark appears next to credentials with 'Connection successful' message.
Common mistake — Bot tokens start with 'xoxb-' not 'xoxp-'. User tokens won't work for this trigger.
4

Add Node > Logic > IF

Add Message Filter

Filter messages to only process ones containing email content. This prevents the workflow from running on casual chat messages.

  1. 1Add an 'IF' node after Slack
  2. 2Set condition to 'String' > 'Contains'
  3. 3Set Value 1 to '{{$node["Slack Trigger"].json["text"]}}'
  4. 4Set Value 2 to '@' (to detect email addresses)
What you should see: IF node shows two output paths: 'true' and 'false'.
Common mistake — Test with a real message containing an email - sample data won't trigger the filter correctly.
OpenAI
OP
trigger
filter
Condition
matches criteria?
yes — passes through
no — skipped
Slack
SL
notified
5

Add Node > Helpers > Code

Extract Email Content

Parse the Slack message to extract the original email text. This cleans up the content before sending to OpenAI.

  1. 1Add a 'Code' node on the 'true' path
  2. 2Set Mode to 'Run Once for Each Item'
  3. 3Paste email extraction code in the JavaScript field
  4. 4Map input to Slack message text
What you should see: Code node outputs structured data with extracted email content.
6

Add Node > AI > OpenAI

Connect OpenAI

Add OpenAI credentials to enable GPT-4 access. You'll need an API key from platform.openai.com with sufficient credits.

  1. 1Add an 'OpenAI' node after the Code node
  2. 2Select 'Chat' operation
  3. 3Click 'Create New' under Credentials
  4. 4Paste your OpenAI API key and save
What you should see: OpenAI node shows green connection status.
Common mistake — API keys starting with 'sk-' are correct. Don't use organization keys.
7

OpenAI Node > Messages > Add Message

Configure GPT-4 Prompt

Set up the prompt that instructs GPT-4 to draft a professional email response. This determines the tone and structure of generated replies.

  1. 1Set Model to 'gpt-4' in the OpenAI node
  2. 2Add a system message: 'You are a professional email assistant. Draft polite, concise responses.'
  3. 3Set user message to include the extracted email content
  4. 4Set Max Tokens to 300
What you should see: OpenAI configuration shows model 'gpt-4' with your custom prompt.
Common mistake — GPT-4 costs 20x more than GPT-3.5. Use gpt-3.5-turbo for high-volume scenarios.
8

Add Node > Helpers > Code

Format Response Output

Structure the GPT-4 response for clean display in Slack. This adds formatting and context around the drafted email.

  1. 1Add another 'Code' node after OpenAI
  2. 2Extract the response text from OpenAI output
  3. 3Add formatting with headers and line breaks
  4. 4Include original message context
What you should see: Formatted response with clear 'Draft Response:' header and proper spacing.
Common mistake — Map fields using the variable picker — don't type field names manually. Hand-typed variable names often have invisible spacing errors that produce blank output.
9

Add Node > Communication > Slack

Send to Slack Thread

Post the drafted response as a thread reply to the original message. This keeps conversations organized and provides context.

  1. 1Add a 'Slack' node set to 'Send Message'
  2. 2Map Channel to the original channel
  3. 3Set Thread TS to the original message timestamp
  4. 4Map Text to your formatted response
What you should see: Slack node configured to reply in thread with the drafted email.
Common mistake — Thread TS must match exactly - missing this posts as a new message instead of a reply.
10

Node Settings > On Error

Add Error Handling

Set up error handling for API failures and rate limits. This prevents the workflow from breaking when OpenAI is unavailable.

  1. 1Click the OpenAI node settings gear
  2. 2Set 'On Error' to 'Continue With Last Node'
  3. 3Add an IF node to check for errors
  4. 4Route errors to a Slack notification
What you should see: Error handling path shows alternative flow for API failures.
11

Workflow > Test Workflow

Test the Workflow

Run a complete test with a real client email pasted in Slack. This verifies all connections and data mapping work correctly.

  1. 1Click 'Test Workflow' in the top bar
  2. 2Paste a sample client email in your Slack channel
  3. 3Watch the workflow execution in real-time
  4. 4Verify the response appears as a thread reply
What you should see: Workflow executes successfully and posts a drafted email response in Slack thread.
Common mistake — Test with real emails, not lorem ipsum - GPT-4 needs actual context to generate useful responses.
n8n
▶ Run once
executed
OpenAI
Slack
Slack
🔔 notification
received
12

Workflow > Active Toggle

Activate Production Mode

Enable the workflow to run automatically on new Slack messages. This makes the automation live for your team.

  1. 1Click the toggle switch to 'Active'
  2. 2Verify the status shows 'Active' with green indicator
  3. 3Test with one more real message to confirm
  4. 4Share the channel with your team
What you should see: Workflow status shows 'Active' and automatically processes new messages.

Drop this into an n8n Code node.

JavaScript — Code Node// Extract email body from Slack message
▸ Show code
// Extract email body from Slack message
const message = $input.first().json.text;
const emailMatch = message.match(/From:[\s\S]*?(?=\n\n|$)/i);

... expand to see full code

// Extract email body from Slack message
const message = $input.first().json.text;
const emailMatch = message.match(/From:[\s\S]*?(?=\n\n|$)/i);
if (emailMatch) {
  return [{ json: { email_content: emailMatch[0], clean_text: emailMatch[0].replace(/^From:|^To:|^Subject:/gmi, '').trim() } }];
} else {
  return [{ json: { error: 'No email format detected' } }];
}

Scaling Beyond 100+ emails/day+ Records

If your volume exceeds 100+ emails/day records, apply these adjustments.

1

Switch to GPT-3.5 Turbo

GPT-4 costs $0.06 per 1K tokens while GPT-3.5 costs $0.002. For simple email responses, the quality difference is minimal but costs drop 30x.

2

Add Queue Management

Use N8n's HTTP Request Queue to batch OpenAI calls and avoid rate limiting. Queue processes 5 emails at once instead of overwhelming the API.

3

Cache Common Responses

Store frequently used responses in a Google Sheet lookup table. Check for similar emails first before calling OpenAI to reduce API usage by 40-60%.

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 N8n for this if your team codes occasionally and you want full control over the email parsing logic. The JavaScript nodes handle complex email extraction better than Zapier's limited text formatters, and you can customize the GPT-4 prompts with conditional logic based on email type or sender. Skip N8n if you need this running in 10 minutes - Make's visual OpenAI connector is faster to set up.

Cost

This workflow burns 2-3 executions per email (trigger + processing + response). At 50 emails/month, that's 150 executions total. N8n's starter plan includes 5,000 executions for $20/month, so you're well covered. Zapier would cost $30/month for the same volume since their GPT-4 integration requires the Professional tier. Make charges per operation but includes OpenAI calls free - roughly $15/month for 50 emails.

Tradeoffs

Make wins on speed here - their native OpenAI module connects in 2 clicks versus N8n's manual API configuration. Zapier handles Slack threading more reliably with built-in thread management. But N8n gives you JavaScript processing power that the others can't match. You can parse complex email formats, extract specific data like order numbers or dates, and build conditional prompts based on email content.

OpenAI's API returns different response structures depending on the model version - GPT-4 wraps text in a 'content' field while GPT-3.5 uses 'text'. Your parsing code breaks when OpenAI updates their response format. Rate limits hit at 3 requests per minute on free OpenAI accounts, causing 429 errors during busy periods. Slack's thread timestamps expire after 6 months, so old email threads will fail the reply mapping.

Ideas for what to build next

  • Add Response ApprovalCreate Slack buttons for 'Approve' and 'Edit' so team members can review AI drafts before sending. Routes to a separate workflow for actual email delivery.
  • Track Email SentimentAdd sentiment analysis to classify incoming emails as urgent, positive, or complaints. Route different types to different response templates or team members.
  • Auto-Send Approved ResponsesConnect to Gmail or Outlook APIs to automatically send approved drafts. Include a 30-second delay window for cancellation in case of errors.

Related guides

Was this guide helpful?
OpenAI + Slack overviewn8n profile →