深入剖析教練課程晨間摘要工作流程的節點邏輯
Morning Course Digest for Coaches Node Logic Deep Dive
這個 n8n 工作流程每日透過 RSS 收集課程資訊,整理成摘要後發送至 Slack 頻道,供教練和課程創作者查看。流程由 5 個節點組成,包括定時觸發、擷取 RSS、分批處理、編寫摘要及發送 Slack 訊息;RSS 項目會分批處理,摘要列出三項精簡、可行的要點。
The alarm at 06:30 rings across a quiet home office. A coach opens her laptop and glances at the Slack channel dedicated to course updates. The daily summary has already arrived, compiled from three RSS feeds she follows. She scans the bullet points, picks one link to read fully, and drafts a response to a student all before her first client call at 09:00. This workflow automates that morning compilation.
At a glance
- Built for: coaches and course creators
- Difficulty: beginner
- Starts with: Schedule Trigger (scheduleTrigger)
- Steps: 5 nodes
- Tools: n8n, Slack, RSS Feed
Schedule Trigger Node
The scheduleTrigger node is the entry point for the workflow. It is configured to fire at 07:00 UTC every morning. On each run, it outputs a single execution context that downstream nodes inherit. The node does not fetch any data itself; it simply signals the start of the run and passes the current timestamp to the next node in the chain.
Fetch RSS Feed Node
The httpRequest node receives the trigger payload from the schedule and initiates three separate HTTP GET requests to the configured RSS feed URLs. Each request returns an XML document structured with channel items, including title, link, description, and pubDate. The node outputs an array of these items, which can number from a handful to dozens depending on how recently each feed was updated. The node handles basic HTTP errors, but if a feed is permanently down, the workflow stops at this point unless error handling is added.
Split In Batches Node
The splitInBatches node takes the array of RSS items from the previous node and breaks them into manageable chunks. A batch size of 5 is typical, meaning if 12 items are returned, the workflow creates three batches: two full batches of five and one final batch of two. Each batch is processed independently by the next node, allowing the summarization logic to run in parallel across groups of articles rather than one by one.
Code Node
The code node receives one batch of RSS items at a time. Inside the function, the node iterates over the items and extracts the title and description fields. It then constructs a prompt that asks the large language model to summarize the content into three concise, actionable points suitable for a coach’s audience. The node outputs a single string per batch, formatted as markdown with a bold title link and a bullet list of points. If the description is missing, the node skips that item and logs a warning, ensuring the output does not contain broken references.
Slack Node
The slack node gathers the formatted summary strings from all batches and posts them to a specified Slack channel via an incoming webhook. The message includes the date at the top and a divider line before the bullet points. The node outputs a confirmation ID from Slack, which the workflow uses to verify delivery, but the coach sees only the published message in the channel.
Worked Example
Input (fictional RSS item):
{
"title": "10 Productivity Hacks for Online Coaches",
"description": "Learn how to batch your client sessions, use timers for focus blocks, and automate your email follow-ups. Updated this week.",
"link": "https://examplecoachblog.com/productivity-hacks"
}
After scheduleTrigger: The workflow begins; timestamp 2024-05-20T07:00:00Z is attached to the execution.
After httpRequest: The item is included in the XML response array alongside other feed entries.
After splitInBatches (batch size 3): This item resides in the first batch of three.
After code node: The output string is:
**10 Productivity Hacks for Online Coaches**
- Batch client sessions to reduce context switching.
- Set timers for deep focus blocks during peak hours.
- Automate email follow-ups after each session.
After slack node: The message appears in the "course-digest" channel with the date prefix and the markdown above.
Key takeaways
- The scheduleTrigger node fires on a cron-like schedule and passes a timestamp to downstream nodes.
- The httpRequest node fetches raw XML from RSS feeds and outputs an item array that may vary in length.
- The splitInBatches node divides the item array into chunks so the code node can process them in parallel batches.
Before you import it
- A running n8n instance (cloud or self-hosted).
- n8n account
- Slack workspace access
- RSS feed URLs for course content
- Sample data to test with, before pointing it at real records.
Get the free workflow
The importable JSON for Morning Course Digest for Coaches is free to download: https://lanexbuilds.com/library
This workflow was generated with AI assistance. Test it with sample data before using it on real data.
來源:DEV Community · dev.to