Material Issue Request and Approval
Configured with Gmail, Google Sheets, Item Lists, Supabase, and additional nodes. Review the connections and setup before adapting this template.
Node categories in this workflow
- Data store
- Trigger
- Transform
- Code
- Messaging
- Routing
Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.
Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.
How it works
The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.
| Node | Category | Type | Operation |
|---|---|---|---|
| Append Material Request | Data store | Google Sheets | append |
| Get Approvals | Trigger | Webhook | See node parameters |
| Standardize Data | Transform | Edit Fields | See node parameters |
| Update Stock | Code | Code | See node parameters |
| Receive Issue Request | Trigger | Webhook | See node parameters |
| Send Approval Request | Messaging | Gmail | See node parameters |
| Prepare Approval | Code | Code | See node parameters |
| Create Record Issue | Data store | Supabase | See node parameters |
| Search Product ID | Data store | Supabase | getAll |
| Searck Issues | Data store | Supabase | getAll |
| Update Current Stck | Data store | Supabase | update |
| Merge Lookups | Transform | Merge | See node parameters |
| Update Current Stock1 | Data store | Google Sheets | update |
| LookUp Current stock1 | Data store | Google Sheets | See node parameters |
| Low stock Detection1 | Code | Code | See node parameters |
| Merge1 | Transform | Merge | See node parameters |
| Append Raw Materials | Data store | Google Sheets | append |
| Calculate Total Price | Code | Code | See node parameters |
| Calculate Updated Current Stock | Code | Code | See node parameters |
| Validate Quantity Received | Code | Code | See node parameters |
| Initialize New Product stock | Data store | Google Sheets | append |
| Update Current Stock | Data store | Google Sheets | update |
| LookUp Current stock | Data store | Google Sheets | See node parameters |
| New Row Current Stock | Data store | Supabase | See node parameters |
| Current Stock Update | Data store | Supabase | update |
| Search Current Stock | Data store | Supabase | getAll |
| Format response | Transform | Item Lists | removeDuplicates |
| Merge | Transform | Merge | See node parameters |
| Low stock Detection2 | Code | Code | See node parameters |
| Receive Raw Materials Webhook | Trigger | Webhook | See node parameters |
| Standardize Raw Material Data | Transform | Edit Fields | See node parameters |
| Lookup Existing Stock | Data store | Google Sheets | See node parameters |
| Check If Product ID Exists | Routing | If | See node parameters |
| New Record Row | Data store | Supabase | See node parameters |
| Trigger Low Stock Alert | Routing | If | See node parameters |
| Send Low Stock Email Alert | Messaging | Gmail | See node parameters |
| Low Stock Email Alert | Messaging | Gmail | See node parameters |
| Validate Issue Request Data | Code | Code | See node parameters |
| Verify Requested Quantity | Code | Code | See node parameters |
| Check Available Stock for Issue | Data store | Google Sheets | See node parameters |
| Format Approval Response | Transform | Edit Fields | See node parameters |
| Verify Approval Data | Code | Code | See node parameters |
| Retrieve Issue Request Details | Data store | Google Sheets | See node parameters |
| Process Approval Decision | Routing | If | See node parameters |
| Get Stock for Issue Update from Current | Data store | Google Sheets | See node parameters |
| Update Stock After Issue | Data store | Google Sheets | update |
| Materials Issue Table Update | Data store | Supabase | update |
| Is Stock is Low | Routing | If | See node parameters |
Setup
- Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
- Connect your own credentials through n8n’s credential store. Replace
REPLACE_WITH_*values with your resource identifiers. - Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
- Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.
Requirements
An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.
Credential types declared in the source
None declared. HTTP requests and Code nodes may still need configuration.
Workflow notes
Raw Materials Inventory Management with Google Sheets and Supabase using n8n Webhooks
Raw Materials Inventory Management with Google Sheets and Supabase using n8n Webhooks
Introduction
This n8n automation streamlines raw materials inventory management by automating the receipt of materials, issuing materials upon approval, updating stock levels, and sending low stock alerts. It integrates webhooks, Google Sheets, Supabase, and Gmail to ensure efficient inventory tracking and communication.
Problem Statement
Manual inventory management is time-consuming and error-prone, often leading to stock discrepancies, delayed approvals for material issuance, and missed low stock alerts. This automation addresses these issues by providing a seamless workflow for receiving raw materials, processing issue requests, and monitoring stock levels in real time.
Target Audience
This template is designed for:
- Small to medium-sized businesses managing raw materials inventory.
- Inventory managers seeking to automate stock updates and approvals.
- n8n users familiar with Google Sheets, Supabase, and Gmail integrations.
Description
Flow 1: Raw Materials Receiving and Stock Update
Purpose: Automates the receipt of raw materials, calculates costs, updates stock, and sends low stock alerts.
-
Receive Raw Materials Webhook
- Purpose: Receives raw material data via HTTP POST at a webhook URL from a form submission.
- Input: JSON with fields like
product_id,quantity_received,unit_price, submitted via a form (e.g., Google Form or custom form). - Output: Raw webhook data.
- Notes: Expects
Content-Type: application/json.
-
Standardize Raw Material Data
- Purpose: Maps webhook data into a consistent format.
- Input: Webhook JSON from form submission.
- Output: JSON with fields like
Timestamp,Product ID,Quantity Received. - Notes: Aligns field names for downstream nodes.
-
Calculate Total Price
- Purpose: Computes total cost and validates numeric inputs.
- Input: Standardized JSON.
- Output: JSON with
Total Price(Quantity Received * Unit Price). - Notes: Uses a custom function to handle invalid numbers.
-
Append Raw Materials
- Purpose: Records the receipt in Google Sheets.
- Input: Calculated JSON.
- Output: Updated "Raw Materials" sheet with new record.
- Notes: Requires Google Sheets credentials (to be configured by the user).
-
Check Quantity Received Validity
- Purpose: Ensures
Quantity Receivedis a positive number. - Input: JSON from Append Raw Materials.
- Output: Validated JSON with numeric
Quantity Received. - Notes: Throws error if invalid.
- Purpose: Ensures
-
Lookup Existing Stock
- Purpose: Retrieves existing stock for the
Product ID. - Input: Validated JSON.
- Output: JSON with
Current Stockfrom "Current Stock" sheet. - Notes: Google Sheets lookup by
Product ID.
- Purpose: Retrieves existing stock for the
-
Check If Product Exists
- Purpose: Branches based on whether the
Product IDexists in stock. - Input: JSON from Lookup Existing Stock.
- Output: True/False branch.
- Notes: Condition checks for
Product IDexistence.
- Purpose: Branches based on whether the
-
Calculate Updated Current Stock (True Branch)
- Purpose: Updates stock by adding
Quantity Received. - Input: JSON with existing stock.
- Output: JSON with
Updated Current Stock. - Notes: Ensures numeric accuracy.
- Purpose: Updates stock by adding
-
Update Current Stock (True Branch)
- Purpose: Updates the "Current Stock" sheet with new stock.
- Input: Updated stock JSON.
- Output: Updated "Current Stock" sheet.
- Notes: Matches by
Product ID.
-
Retrieve Updated Stock for Check (True Branch)
- Purpose: Retrieves updated stock for low stock check.
- Input: Updated stock JSON.
- Output: JSON with current stock data.
- Notes: Google Sheets lookup.
-
Detect Low Stock Level (True Branch)
- Purpose: Flags if stock falls below the minimum level.
- Input: Retrieved stock data.
- Output: JSON with
Is Lowflag andAlert Message. - Notes: Compares with
Minimum Stock Level(default: 50).
-
Trigger Low Stock Alert (True Branch)
- Purpose: Triggers notification if stock is low.
- Input: Low stock detection JSON.
- Output: True branch sends email.
- Notes: Condition:
{{ $json['Is Low'] }}.
-
Send Low Stock Email Alert (True Branch, Low)
- Purpose: Sends low stock alert email to the stock manager.
- Input: JSON with alert details.
- Output: HTML email to a user-configured email address.
- Notes: Includes product info and reorder link; email address must be set by the user.
-
Add New Product to Stock (False Branch)
- Purpose: Adds new product to "Current Stock" sheet.
- Input: Validated JSON.
- Output: New row with initial stock (Quantity Received).
- Notes: Sets
Minimum Stock Levelto 50.
-
Current Stock Update (True Branch, Supabase)
- Purpose: Updates Supabase
Current Stocktable. - Input: Updated stock JSON.
- Output: Updated Supabase record.
- Notes: Matches by
Product ID; requires user-configured Supabase credentials.
- Purpose: Updates Supabase
-
New Row Current Stock (False Branch, Supabase)
- Purpose: Inserts new product into Supabase
Current Stocktable. - Input: Validated JSON.
- Output: New Supabase record.
- Notes: Sets initial stock; requires Supabase credentials.
- Purpose: Inserts new product into Supabase
-
Search Current Stock (Supabase)
- Purpose: Retrieves
Current Stockrecords forProduct ID. - Input: JSON with
Product ID. - Output: JSON array of matching records.
- Notes: Uses
returnAll: true.
- Purpose: Retrieves
-
New Record Raw (Supabase)
- Purpose: Inserts raw material record into Supabase
Raw Materialstable. - Input: Calculated JSON.
- Output: New Supabase record.
- Notes: Auto-maps input data.
- Purpose: Inserts raw material record into Supabase
-
Format Response
- Purpose: Removes duplicates from response.
- Input: Search Current Stock data.
- Output: Cleaned JSON array.
- Notes: Ensures unique records.
-
Combine Stock Update Branches
- Purpose: Combines branches (existing/new product).
- Input: Outputs from Check If Product Exists branches.
- Output: Merged JSON.
- Notes: Ensures data continuity.
Impact: Automates raw material receipt, ensures accurate stock updates, and provides timely low stock notifications.
Flow 2: Material Issue Request and Approval
Purpose: Automates material issue requests, processes approvals/rejections, updates stock, and sends low stock alerts.
-
Receive Material Issue Webhook
- Purpose: Receives material issue request via HTTP POST at a webhook URL from a form submission.
- Input: JSON with
Product ID,Quantity Requested, etc., submitted via a form (e.g., Google Form or custom form). - Output: Raw webhook data.
- Notes: Webhook trigger for issue requests.
-
Standardize Data
- Purpose: Normalizes request data and generates approval link.
- Input: Webhook JSON from form submission.
- Output: JSON with
Status"Pending,"Approval Link. - Notes: Maps form fields for consistency.
-
Validate Issue Request Data
- Purpose: Ensures
Quantity Requestedis a positive number. - Input: Standardized JSON.
- Output: Validated JSON or error.
- Notes: JavaScript validation.
- Purpose: Ensures
-
Verify Requested Quantity
- Purpose: Validates additional fields like
Product IDandSubmission ID. - Input: Validated JSON.
- Output: Further validated JSON or error.
- Notes: Ensures data integrity.
- Purpose: Validates additional fields like
-
Append Material Request
- Purpose: Records request in "Materials Issued" sheet.
- Input: Verified JSON.
- Output: Updated "Materials Issued" sheet.
- Notes: Google Sheets append operation.
-
Check Available Stock for Issue
- Purpose: Retrieves
Current StockforProduct ID. - Input: Appended JSON.
- Output: JSON with stock data.
- Notes: Google Sheets lookup.
- Purpose: Retrieves
Approval Process
The following steps handle the approval of material issue requests, ensuring that requests are reviewed and either approved or rejected before stock is updated.
-
Prepare Approval
- Purpose: Checks if stock is sufficient to fulfill the request.
- Input: Stock data from Check Available Stock for Issue.
- Output: JSON with
Is Enoughflag (true ifCurrent Stock>=Quantity Requested). - Notes: Prepares data for the approval email.
-
Send Approval Request
- Purpose: Sends an email to the approver with clickable Approve/Reject buttons.
- Input: JSON with
Is Enough,Product ID,Quantity Requested, andApproval Link. - Output: HTML email to a user-configured email address.
- Notes: Email contains buttons linking to the Receive Approval Response webhook; email address must be set by the user.
-
Receive Approval Response
- Purpose: Captures the approver’s decision via a webhook triggered by clicking Approve/Reject.
- Input: Webhook parameters like
submissionId,action("approve" or "reject"),quantity. - Output: Raw webhook data with approval details.
- Notes: Webhook URL must be configured to match the links in the approval email.
-
Format Approval Response
- Purpose: Processes the approval response and adds metadata.
- Input: Webhook JSON from Receive Approval Response.
- Output: JSON with
Action,Approved Quantity,Approval Date. - Notes: Sets
Approval Dateto the current timestamp.
-
Verify Approval Data
- Purpose: Validates the approval response to ensure it’s complete and correct.
- Input: Formatted JSON.
- Output: Validated JSON or error.
- Notes: Checks for valid
Submission ID,Action, andApproved Quantity(> 0).
-
Retrieve Issue Request Details
- Purpose: Retrieves the original issue request for updating.
- Input: Validated JSON with
Submission ID. - Output: JSON with request data from "Materials Issued" sheet.
- Notes: Google Sheets lookup by
Submission ID.
-
Process Approval Decision
- Purpose: Branches the flow based on the approver’s decision.
- Input: JSON with
Action("approve" or "reject"). - Output: True branch (approved) or False branch (rejected).
- Notes: Condition:
{{ $json['Action'] === "approve" }}.
Post-Approval Steps
-
Get Stock for Issue Update (True Branch, Approved)
- Purpose: Retrieves the latest
Current Stockbefore updating. - Input: Approved JSON.
- Output: JSON with stock data.
- Notes: Google Sheets lookup.
- Purpose: Retrieves the latest
-
Deduct Issued Stock (True Branch, Approved)
- Purpose: Reduces stock by
Approved Quantity. - Input: Stock and approval data.
- Output: JSON with
Updated Current Stock. - Notes: Errors if stock is insufficient.
- Purpose: Reduces stock by
-
Update Stock After Issue (True Branch, Approved)
- Purpose: Updates "Current Stock" sheet with new stock.
- Input: Updated stock JSON.
- Output: Updated "Current Stock" sheet.
- Notes: Matches by
Product ID.
-
Retrieve Stock After Issue (True Branch, Approved)
- Purpose: Retrieves updated stock for low stock check.
- Input: Updated stock JSON.
- Output: JSON with stock data.
- Notes: Google Sheets lookup.
-
Detect Low Stock After Issue (True Branch, Approved)
- Purpose: Flags if stock is low after issuance.
- Input: Retrieved stock data.
- Output: JSON with
Is Lowflag andAlert Message. - Notes: Compares with
Minimum Stock Level.
-
Trigger Low Stock Alert After Issue (True Branch, Approved)
- Purpose: Triggers notification if stock is low.
- Input: Low stock detection JSON.
- Output: True branch sends email.
- Notes: Condition:
{{ $json['Is Low'] }}.
-
Send Low Stock Email After Issue (True Branch, Low)
- Purpose: Sends low stock alert email.
- Input: JSON with alert details.
- Output: HTML email to a user-configured email address.
- Notes: Includes product info; email address must be set by the user.
-
Update Issue Request Status (True/False Branch)
- Purpose: Updates request status in "Materials Issued" sheet.
- Input: Approval action JSON.
- Output: Updated sheet with
Status"Approved" or "Rejected." - Notes: Google Sheets update; includes
Approved ByandApproval Dateif approved.
-
Combine Stock Lookup Results
- Purpose: Combines stock lookup branches.
- Input: Outputs from Check Available Stock for Issue and Search Stock by Product ID.
- Output: Merged JSON.
- Notes: Ensures data continuity.
-
Create Record Issue (Supabase)
- Purpose: Inserts issue request into Supabase
Materials Issuedtable. - Input: Verified JSON.
- Output: New Supabase record.
- Notes: Auto-maps data; requires user-configured credentials.
- Purpose: Inserts issue request into Supabase
-
Search Stock by Product ID (Supabase)
- Purpose: Retrieves
Current Stockrecords. - Input: JSON with
Product ID. - Output: JSON array of records.
- Notes: Filters by
Product ID.
- Purpose: Retrieves
-
Issues Table Update (Supabase, True/False Branch)
- Purpose: Updates Supabase
Materials Issuedtable. - Input: Approval action JSON.
- Output: Updated Supabase record.
- Notes: Matches by
Submission ID.
- Purpose: Updates Supabase
-
Update Current Stock (Supabase, True Branch)
- Purpose: Updates Supabase
Current Stocktable. - Input: Updated stock JSON.
- Output: Updated Supabase record.
- Notes: Matches by
Product ID.
- Purpose: Updates Supabase
-
Combine Issue Lookup Branches
- Purpose: Combines issue lookup branches.
- Input: Outputs from Retrieve Issue Request Details and Search Issue by Submission ID.
- Output: Merged JSON.
- Notes: Ensures data continuity.
-
Search Issue by Submission ID (Supabase)
- Purpose: Retrieves issue records by
Submission ID. - Input: Validated JSON.
- Output: JSON array of records.
- Notes: Filters by
Submission ID.
- Purpose: Retrieves issue records by
Impact: Streamlines material issuance, ensures accurate stock updates, and provides proactive low stock alerts.
Conclusion
This automation enhances inventory management by integrating n8n with Google Sheets, Supabase, and Gmail. It reduces manual effort, ensures data accuracy, and keeps teams informed with timely alerts. Community feedback and contributions are welcome!
Material Issue Request and Approval
Material Issue Request and Approval
Purpose and structure
This folder contains the Material Issue Request and Approval workflow. Its executable nodes use code, gmail, googleSheets, if, itemLists, merge, set, supabase, webhook. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.
Setup
Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.
Entry points
Get Approvals, Receive Issue Request, Receive Raw Materials Webhook
Verification
Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.
Attribution
https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Code/0926_Code_Webhook_Create_Webhook.json MIT; preserve source notices.
Canvas section labels
These name areas of the original canvas; they do not include explanatory instructions.
- Material Issue Request and Approval
- Raw Materials Receiving and Stock Update