n8n Inventory Slack Alert Workflow Guide
This reference-style guide explains the “Inventory Slack Alert” n8n workflow template in depth. It focuses on how each node interacts, how data flows through the pipeline, and how to configure the workflow for reliable, production-grade inventory alerting, semantic search, and logging.
The workflow uses the following core components: a Webhook trigger, a character-based Text Splitter, Cohere embeddings, a Pinecone vector index, an n8n Vector Tool, Window Memory, an OpenAI Chat Model, a RAG Agent, Google Sheets logging, and a Slack-based error handler.
1. Workflow Overview
The Inventory Slack Alert workflow is designed to process inventory-related events (such as low stock, incoming shipments, or SKU mismatches) and produce contextual, AI-generated summaries and recommended actions. It also maintains a searchable history of events and notifies your team if the workflow encounters errors.
At a high level, the workflow:
- Receives inventory events via a Webhook Trigger.
- Splits the event text into chunks using a Text Splitter.
- Generates embeddings with Cohere and stores them in Pinecone.
- Queries Pinecone for semantically relevant context using a Pinecone Query node.
- Wraps the vector index as a Vector Tool and feeds it into a RAG Agent with Window Memory and an OpenAI Chat Model.
- Appends the RAG Agent’s output to a Google Sheet for logging.
- Sends a Slack alert if the RAG Agent node fails.
This makes the workflow suitable for teams that need:
- Fast and contextual inventory notifications.
- A semantic, vector-based history of events for retrieval and analysis.
- Traceable, auditable logs via Google Sheets.
- Automated error visibility through Slack.
2. Architecture & Data Flow
2.1 High-level sequence
- An external system sends a
POSTrequest to the webhook endpoint/webhook/inventory-slack-alert. - The workflow extracts the relevant message content and passes it to the Text Splitter.
- The Text Splitter produces overlapping text chunks optimized for embedding.
- The Cohere Embeddings node converts each chunk into a dense vector.
- Pinecone Insert writes these vectors to the
inventory_slack_alertindex, including any metadata you choose to store. - Pinecone Query retrieves semantically similar context from existing vectors.
- The Vector Tool exposes the Pinecone-backed retrieval capability to the RAG Agent.
- Window Memory provides short-term context across related events or conversational steps.
- The RAG Agent, backed by an OpenAI Chat Model, generates a concise, human-readable summary and recommended actions.
- The Append Sheet (Google Sheets) node writes the resulting output to a “Log” sheet for auditing.
- If the RAG Agent node throws an error, the Slack Alert node sends the error details to the
#alertschannel.
2.2 Error handling path
The Slack Alert node is connected via the onError route from the RAG Agent. This means:
- If the RAG Agent executes successfully, the workflow continues to the Google Sheets logging step.
- If the RAG Agent fails (for example, due to LLM API issues or invalid input), the
onErrorconnection triggers the Slack Alert node, which sends a message containing error information to#alerts.
This pattern provides immediate visibility into failures without interrupting upstream systems that send the webhook events.
3. Node-by-Node Breakdown
3.1 Webhook Trigger
- Node type: Webhook Trigger
- HTTP method:
POST - Path:
inventory-slack-alert
The Webhook Trigger is the entry point for external inventory events. Typical sources include:
- Inventory management systems.
- Warehouse management systems.
- Middleware or integration platforms.
External systems should send JSON payloads to:
POST https://<your-n8n-domain>/webhook/inventory-slack-alert
Content-Type: application/json
The payload can contain fields such as sku, event, quantity, warehouse, and free-form notes. These fields are later used for embedding, retrieval, and logging.
Edge cases
- Invalid JSON or missing fields can cause downstream nodes (especially the RAG Agent) to behave unexpectedly. Use n8n’s built-in validation or pre-processing if your upstream systems are inconsistent.
- Ensure the webhook is reachable over HTTPS and protected with a secret token or IP allowlist where possible.
3.2 Text Splitter (Character Text Splitter)
- Node type: Text Splitter
- Splitter: Character Text Splitter
- chunkSize:
400 - chunkOverlap:
40
This node takes the incoming text (for example, notes, descriptions, or concatenated fields) and splits it into overlapping chunks. Character-based splitting is used to keep segments within an optimal length for embedding while preserving local context.
Why splitting matters:
- It improves the quality of embeddings by focusing on smaller, contextually coherent segments.
- It prevents overly long strings from degrading embedding performance or exceeding model limits.
Configuration notes
- The default
chunkSize = 400andchunkOverlap = 40are suitable for most inventory messages. - If your events are structured JSON, consider parsing key fields (such as SKU, quantity, and warehouse) before concatenating them into the text that is split, so the vector store captures meaningful metadata-rich text.
3.3 Embeddings (Cohere)
- Node type: Embeddings
- Provider: Cohere
- Model:
embed-english-v3.0 - Credentials: Cohere API key
The Embeddings node converts each text chunk into a dense vector representation. These vectors are later stored in Pinecone for semantic search.
Key aspects:
- The model
embed-english-v3.0is a general-purpose English embedding model suitable for inventory text, product descriptions, and operational notes. - Embeddings allow retrieval of relevant events even if the query uses different wording or partial information.
Edge cases
- API rate limits or key misconfiguration will cause this node to fail, which in turn affects downstream Pinecone inserts and queries.
- Check Cohere API quotas if you process a high volume of events.
3.4 Pinecone Insert & Pinecone Query
- Node types: Pinecone Insert, Pinecone Query
- Index name:
inventory_slack_alert
Pinecone Insert
This node writes the generated embeddings into a Pinecone vector index named inventory_slack_alert. Each embedding is stored as a vector with optional metadata.
Typical metadata fields you may attach (via n8n expressions or mappings):
skuwarehouseevent(for example,low_stock,incoming_shipment)timestamp
Pinecone Query
This node queries the same inventory_slack_alert index to retrieve semantically similar vectors. The query is typically based on the current event text, its embedding, or a derived query vector.
Retrieved results provide context such as:
- Previous alerts for the same SKU or warehouse.
- Similar anomalies or known issues.
- Product descriptions or historical notes.
Index management considerations
- Ensure the index
inventory_slack_alertexists with a dimension that matches the Cohere embedding size. - Use metadata-based filters (for example, by SKU or warehouse) to narrow down retrieval when necessary.
- Implement a retention policy for very old vectors if storage cost is a concern. You can periodically archive or delete outdated entries.
3.5 Vector Tool
- Node type: Vector Tool
The Vector Tool node wraps the Pinecone index as a tool that can be consumed by the RAG Agent. It abstracts away the low-level query details and exposes a retrieval interface to the agent.
Functionally, this node:
- Takes a query or input from the RAG Agent.
- Uses Pinecone to fetch relevant context.
- Returns document snippets or context blocks that the agent can reason over.
3.6 Window Memory
- Node type: Window Memory
The Window Memory node maintains a sliding window of recent messages or events. It is used to give the RAG Agent short-term context without persisting all data indefinitely.
Typical uses in this workflow:
- Preserving the last few inventory events for a SKU or warehouse within the same execution or conversational thread.
- Helping the RAG Agent understand the immediate history when generating recommendations.
The memory buffer size can be tuned depending on how much context you want the agent to consider.
3.7 Chat Model (OpenAI)
- Node type: Chat Model
- Provider: OpenAI
The Chat Model node provides the underlying large language model used by the RAG Agent to generate natural language output. It receives the system prompt, user input, and retrieved context, then returns a structured response.
Typical behaviors:
- Summarizes inventory issues.
- Suggests immediate operational actions.
- Flags potential follow-up tasks or investigations.
Ensure that your OpenAI credentials are correctly configured and that your selected model is supported in your account and region.
3.8 RAG Agent
- Node type: RAG Agent
- System message: You are an assistant for Inventory Slack Alert.
The RAG Agent orchestrates retrieval and generation. It combines:
- The incoming event payload from the Webhook.
- Contextual information retrieved via the Vector Tool and Pinecone.
- Short-term history from Window Memory.
- The generative capabilities of the OpenAI Chat Model.
Its output is a concise, human-readable description of the inventory event, often including suggested actions or diagnostics.
Prompting guidelines
A more detailed system prompt can improve reliability. For example:
You are an assistant for Inventory Slack Alert. Summarize the issue, suggest immediate actions, and flag any follow-ups needed.
Keep the system message stable and use the event payload and retrieved context as the main inputs for variability.
Error behavior
- If the RAG Agent fails (for instance, due to LLM timeouts or malformed inputs), the workflow’s
onErrorpath triggers the Slack Alert node. - Capture error messages and stack traces (where available) so they can be forwarded to Slack and optionally logged elsewhere.
3.9 Append Sheet (Google Sheets)
- Node type: Google Sheets – Append Sheet
- Target sheet:
Log - Credentials: Google Sheets OAuth2
This node persists each processed event and the RAG Agent’s output to a Google Sheet. The sheet provides an audit trail and a simple analytics surface.
Configuration details:
- Specify your
SHEET_IDfor the Google Sheet that contains a tab namedLog. - Ensure the
Logsheet exists and has appropriate headers (for example, timestamp, SKU, event type, warehouse, summary, recommended action). - Map the RAG Agent’s output fields and selected payload fields to the correct columns.
This log can later be used for reporting, anomaly analysis, or manual audits.
3.10 Slack Alert (Error Handler)
- Node type: Slack
- Channel:
#alerts - Connection: attached to RAG Agent via
onErrorroute
The Slack Alert node sends a message to the #alerts channel when the RAG Agent fails. It should include at least:
- A short description of the failure.
- Key details from the event payload, if available.
- Error message or stack trace when provided by n8n.
This makes it easy for operations teams to triage issues quickly and investigate potential configuration or API problems.
4. Configuration Checklist
Before running the workflow, ensure the following configuration steps are complete:
- Credentials
- Cohere API key for embeddings.
- Pinecone API key and environment for vector storage.
- OpenAI API key for the Chat Model.
- Google Sheets OAuth2 credentials with access to the target spreadsheet.
- Slack credentials or app token with permission to post to
#alerts.
- Pinecone index
- Create or configure the index named
inventory_slack_alert. - Ensure the index dimension matches the Cohere
embed-english-v3.0embedding size.
- Create or configure the index named
- Google Sheets
- Set the
SHEET_IDin the Append Sheet node. - Create a sheet/tab named
Logwith the headers you plan to use.
- Set the
- Webhook
- Configure the Webhook Trigger path to
inventory-slack-alert. - Expose the webhook URL to your inventory system using HTTPS.
- Configure the Webhook Trigger path to
- Slack
- Confirm the Slack channel name
#alertsexists. - Verify that the Slack node uses the correct credentials and has permission to
- Confirm the Slack channel name
