XBSTACK XBSTACK
Xiaobai

Xiaobai

Developer · Builder

Building AI engineering systems, developer tools and long-term digital assets at XBSTACK.

About Xiaobai & XBSTACK →
n8n AI Workflow in Action: Slack Daily Digest Bot

n8n AI Workflow in Action: Slack Daily Digest Bot

n8n AI Workflow in Action: A hands-on guide to building a daily briefing AI agent using self-hosted n8n, OpenAI, and the Slack API.

Published · 2026-05-305 min readXBSTACK
#n8n#slack#openai#workflow-automation#daily-digest

Who This Guide Is For

  • Project managers and team leads who need to monitor multiple Slack channels, are overwhelmed by hundreds of chat messages daily, and urgently want to free up their attention through automation.
  • Independent project managers who want to leverage open-source tools and AI to implement business workflows but are highly sensitive to commercial API costs and demand extreme control over expenses.
  • Full-stack developers looking to learn how to deeply orchestrate self-hosted n8n, OpenAI interfaces, and enterprise-grade instant messaging tools.

Collaboration is the Art of Asynchronous Summaries

Being online in real time is not synonymous with efficient collaboration. If a team requires all members to respond to various chat messages in real time, it is essentially trading fragmented time for a false sense of immediacy. True productivity should be built on asynchronous information flows—compressing massive discussions generated throughout the day into decision briefs that can be read in just a few minutes.

By using a self-hosted n8n and OpenAI-powered Slack daily summary bot, we are effectively installing a semantic filter on the team’s communication pipeline. We treat chat logs as unstructured data, use OpenAI’s reasoning capabilities as a fact-extraction engine, and employ n8n as an orchestration tool to automate pulling, cleaning, integrating, and finally pushing today’s decision summaries to the team. This way, team members no longer need to climb hundreds of floors of information.

Architecture Design: Information Funnel and Processing Pipeline

In this practical project, we designed a three-stage processing funnel that transforms chaotic group chat history into structured card briefings:

  1. Collection Phase: Use a Schedule Trigger (e.g., at 6 PM daily) to pull chat logs from specified Slack channels over the past 24 hours.
  2. Refinement Phase: Use JavaScript nodes to clean up noise, discarding meaningless short replies (such as “OK,” “Got it,” etc.), filtering out system deployment notifications sent by bots, and aggregating/reorganizing by channel and Thread.
  3. Push Phase: Pass the formatted context to the large language model, extract today’s decisions, action items, and lingering questions through structured prompts, and finally repack them into Slack Block Kit cards to send to a dedicated notification channel.

Scheduled Pulling and Pre-processing Noise Cleaning

The first step is to create an App in the Slack Developer Portal and configure its OAuth credentials. Ensure you have basic permissions such as channels:history and users:read.

In n8n, we set up a Schedule Trigger to fire daily at a fixed time. Then, we introduce the Slack node’s History method to pull data from the specified channel.

Since the raw message stream contains a large amount of automatic system notifications (such as deployment logs, CI run successes, etc.) and one- or two-character casual chat replies, sending them directly to the large language model would not only waste significant tokens but also interfere with the model’s extraction accuracy. Therefore, we need to insert a Code node (using JavaScript) after the Slack node for physical filtering:

const items = $input.all();
const filteredItems = items.filter(item => {
  const text = item.json.text || "";
  const userId = item.json.user || "";

  if (text.trim().length < 5) return false;

  if (userId === "USYSTEM_BOT_ID") return false;

  if (text.includes("deployment successful") || text.includes("Build completed")) return false;

  return true;
});

return filteredItems;

This pre-filtering layer intercepts approximately 60% of low-value noise at the physical level, significantly reducing the inference burden on downstream large language models.

Multi-thread Aggregation and Context Sorting

In Slack’s chat environment, most discussions occur within specific threads. If messages are flattened into a linear sequence based on timestamps before being sent to an LLM, the model loses track of conversational context and may incorrectly assume that unrelated messages are connected.

To preserve contextual continuity, we aggregate fragmented message streams into a nested tree structure—organized by channel, main discussion, and reply thread—using JavaScript before passing them to the LLM:

const messages = $input.all().map(i => i.json);
const threads = {};

messages.forEach(msg => {
  const threadTs = msg.thread_ts || msg.ts;
  if (!threads[threadTs]) {
    threads[threadTs] = [];
  }
  threads[threadTs].push(`${msg.user_name || msg.user}: ${msg.text}`);
});

const formattedContext = Object.keys(threads).map((threadTs, index) => {
  return `[Thread #${index + 1}]\n${threads[threadTs].join('\n')}`;
}).join('\n\n');

return { json: { chat_history: formattedContext } };

After processing, unstructured messages are transformed into logically distinct conversation units, enabling large language models to accurately track the evolution of discussions.

Large Model Decision Extraction and JSON Formatting

We pass the refined, formatted text into an OpenAI node. We recommend selecting gpt-4o or gpt-4o-mini. Set the Temperature to 0.1. A lower temperature ensures that the model performs factual summarization only, rejecting any speculative or hallucinated content.

Our prompt explicitly requires the model to extract only the following three core pieces of information and output them in a strictly constrained JSON format:

You are a senior project coordinator. Read the Slack conversation history and extract:
1. decisions: decisions or agreements reached today.
2. action_items: assigned tasks, including the owner and concrete action.
3. open_questions: unresolved issues that require follow-up discussion.

Return valid JSON only:
{
  "decisions": ["Adopt Redis queue mode", "Move the production release to Friday"],
  "action_items": ["Prepare migration checklist (Owner: Alex)", "Verify rollback plan (Owner: Jamie)"],
  "open_questions": ["Who owns the final data migration?"]
}

To ensure the output format is 100% immune to parsing failures caused by erratic model punctuation, it is recommended to enable the JSON Schema strict constraint option in the n8n OpenAI node, which restricts the model’s output structure at the underlying level.

Card Assembly and Automated Slack Push

Once you have the structured JSON result, you can directly use the n8n Slack node to invoke the Post Message method. To achieve a polished and professional layout, configure Slack’s Block Kit for card formatting.

You can assemble the JSON into multi-section Layout Blocks—for example, using color-coded bars to distinguish decisions (green), action items (orange), and topics for discussion (gray)—and push them to your team’s public “Daily Briefing” channel. This not only captures data effectively but also allows team members to quickly sync on the actual progress of all projects in just a few seconds before getting off work each day.

Common Pitfalls and Production Error Logs

1. Error: API Rate Limiting

Error: Request failed with status code 429 (Too Many Requests)

Cause: Your workflow instantly pulled and processed a large number of channels, exceeding Slack API’s high-frequency call quota limits.

Solution: Insert a Wait node (set to wait for 500 milliseconds) between the nodes that fetch channel history messages. This will physically smooth out concurrent network requests, allowing you to smoothly navigate the rate-limit threshold.

2. Error: Context exceeds maximum length limit

Error: context_length_exceeded

Reason: When certain development channels generate tens of thousands of messages in a single day, directly packaging the data can quickly fill the LLM’s context window.

Solution: First, configure a maximum character limit in the Code node (e.g., retaining only the latest 5000 characters), or adopt a “channel chunking pre-filter” strategy. Use a smaller model to filter out meaningless chatter from each channel before passing the refined results to the main model for generating the overall summary.

Self-Hosted n8n Solution vs. Slack’s Native AI (Comparison)

When building an information briefing tool for our team, we need to evaluate the differences between a self-hosted solution and similar built-in tools across several key dimensions:

Comparison DimensionSelf-Hosted n8n + OpenAISlack Native AI FeaturesManual Rotation
Data PrivacyExtremely high; chat content is processed locally on self-hosted NAS/VPSModerate; requires authorization for commercial cloud services to process dataAbsolutely secure
Customization LevelExtremely high; supports writing arbitrary JS cleaning rules and Prompt frameworksLow; limited to official preset summary templatesExtremely high
Operational CostVery low; only requires paying for the small amount of tokens consumed by the LLM APIHigh; requires upgrading to Slack’s expensive Enterprise subscriptionExtremely high time cost
Complex Scenario AdaptabilityCan aggregate across multiple channels, integrate with Notion, and export as tablesLimited to local summaries for a single channel or threadHighly adaptable but inefficient

The comparison reveals that the core advantage of using a self-hosted n8n lies in absolute control over data and exceptional cost-effectiveness. We can enjoy professional-grade information filtering services without paying expensive monthly enterprise subscriptions for every team member.

Continue Reading

Topic path / AI workflows

Continue through the production automation path

The workflow hub connects self-hosting, queue mode, webhooks, retries, observability and n8n implementation cases into one production-oriented learning path.

More to Explore

Topic hub →
n8n Gmail Summarizer: Extract Action Items to Google Sheets Step by StepBuild an n8n Gmail summarizer with Gmail Trigger, AI structured extraction, priorities and action items, Message ID deduplication, Google Sheets output, and failure handling.n8n Webhook Production URL: Test vs Production, WEBHOOK_URL, Reverse Proxy, and AuthFix n8n Production URL issues by publishing the workflow, setting WEBHOOK_URL behind a reverse proxy, forwarding proxy headers, and validating auth and idempotency.n8n Queue Mode + Redis in Practice: When to Offload Workflows to a Queuen8n Queue Mode + Redis in Practice: A hands-on guide to deploying n8n Queue Mode, Redis, and Workers in production.Self-Hosted n8n Deployment Guide: Docker Compose, Postgres, VPS, and NAS Production BaselineHow to deploy self-hosted n8n for stability? This article provides a production baseline using Docker Compose + Postgres, covering version pinning, N8N_ENCRYPTION_KEY, WEBHOOK_URL

AI Engineering Weekly

Production changes, real failures, experiments and new XBSTACK assets.

Comments & evidence

DISCUSSION

Questions, verification and corrections

Sign in to comment. Every new comment is reviewed before publication; while pending, it is visible only to you and the administrator.

Sign-in required Reviewed before public
Loading the discussion…