← All N8N workflows
Data & databasesCodeGmailGoogle SheetsIfItem Lists

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.

Workflow preview
Data storeAppend Material RequestGoogle SheetsTriggerGet ApprovalsWebhookTransformStandardize DataEdit FieldsCodeUpdate StockCodeTriggerReceive Issue RequestWebhookMessagingSend Approval RequestGmailCodePrepare ApprovalCodeData storeCreate Record IssueSupabaseData storeSearch Product IDSupabaseData storeSearck IssuesSupabaseData storeUpdate Current StckSupabaseTransformMerge LookupsMergeData storeUpdate Current Stock1Google SheetsData storeLookUp Current stock1Google SheetsCodeLow stock Detection1CodeTransformMerge1MergeData storeAppend Raw MaterialsGoogle SheetsCodeCalculate Total PriceCodeCodeCalculate UpdatedCurrent StockCodeCodeValidate QuantityReceivedCodeData storeInitialize New ProductstockGoogle SheetsData storeUpdate Current StockGoogle SheetsData storeLookUp Current stockGoogle SheetsData storeNew Row Current StockSupabaseData storeCurrent Stock UpdateSupabaseData storeSearch Current StockSupabaseTransformFormat responseItem ListsTransformMergeMergeCodeLow stock Detection2CodeTriggerReceive Raw MaterialsWebhookWebhookTransformStandardize RawMaterial DataEdit FieldsData storeLookup Existing StockGoogle SheetsRoutingCheck If Product IDExistsIfData storeNew Record RowSupabaseRoutingTrigger Low Stock AlertIfMessagingSend Low Stock EmailAlertGmailMessagingLow Stock Email AlertGmailCodeValidate Issue RequestDataCodeCodeVerify RequestedQuantityCodeData storeCheck Available Stockfor IssueGoogle SheetsTransformFormat ApprovalResponseEdit FieldsCodeVerify Approval DataCodeData storeRetrieve Issue RequestDetailsGoogle SheetsRoutingProcess ApprovalDecisionIfData storeGet Stock for IssueUpdate from CurrentGoogle SheetsData storeUpdate Stock AfterIssueGoogle SheetsData storeMaterials Issue TableUpdateSupabaseRoutingIs Stock is LowIf

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.

Workflow node names, types, and operations
NodeCategoryTypeOperation
Append Material RequestData storeGoogle Sheetsappend
Get ApprovalsTriggerWebhookSee node parameters
Standardize DataTransformEdit FieldsSee node parameters
Update StockCodeCodeSee node parameters
Receive Issue RequestTriggerWebhookSee node parameters
Send Approval RequestMessagingGmailSee node parameters
Prepare ApprovalCodeCodeSee node parameters
Create Record IssueData storeSupabaseSee node parameters
Search Product IDData storeSupabasegetAll
Searck IssuesData storeSupabasegetAll
Update Current StckData storeSupabaseupdate
Merge LookupsTransformMergeSee node parameters
Update Current Stock1Data storeGoogle Sheetsupdate
LookUp Current stock1Data storeGoogle SheetsSee node parameters
Low stock Detection1CodeCodeSee node parameters
Merge1TransformMergeSee node parameters
Append Raw MaterialsData storeGoogle Sheetsappend
Calculate Total PriceCodeCodeSee node parameters
Calculate Updated Current StockCodeCodeSee node parameters
Validate Quantity ReceivedCodeCodeSee node parameters
Initialize New Product stockData storeGoogle Sheetsappend
Update Current StockData storeGoogle Sheetsupdate
LookUp Current stockData storeGoogle SheetsSee node parameters
New Row Current StockData storeSupabaseSee node parameters
Current Stock UpdateData storeSupabaseupdate
Search Current StockData storeSupabasegetAll
Format responseTransformItem ListsremoveDuplicates
MergeTransformMergeSee node parameters
Low stock Detection2CodeCodeSee node parameters
Receive Raw Materials WebhookTriggerWebhookSee node parameters
Standardize Raw Material DataTransformEdit FieldsSee node parameters
Lookup Existing StockData storeGoogle SheetsSee node parameters
Check If Product ID ExistsRoutingIfSee node parameters
New Record RowData storeSupabaseSee node parameters
Trigger Low Stock AlertRoutingIfSee node parameters
Send Low Stock Email AlertMessagingGmailSee node parameters
Low Stock Email AlertMessagingGmailSee node parameters
Validate Issue Request DataCodeCodeSee node parameters
Verify Requested QuantityCodeCodeSee node parameters
Check Available Stock for IssueData storeGoogle SheetsSee node parameters
Format Approval ResponseTransformEdit FieldsSee node parameters
Verify Approval DataCodeCodeSee node parameters
Retrieve Issue Request DetailsData storeGoogle SheetsSee node parameters
Process Approval DecisionRoutingIfSee node parameters
Get Stock for Issue Update from CurrentData storeGoogle SheetsSee node parameters
Update Stock After IssueData storeGoogle Sheetsupdate
Materials Issue Table UpdateData storeSupabaseupdate
Is Stock is LowRoutingIfSee node parameters

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. 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 Received is a positive number.
    • Input: JSON from Append Raw Materials.
    • Output: Validated JSON with numeric Quantity Received.
    • Notes: Throws error if invalid.
  • Lookup Existing Stock

    • Purpose: Retrieves existing stock for the Product ID.
    • Input: Validated JSON.
    • Output: JSON with Current Stock from "Current Stock" sheet.
    • Notes: Google Sheets lookup by Product ID.
  • Check If Product Exists

    • Purpose: Branches based on whether the Product ID exists in stock.
    • Input: JSON from Lookup Existing Stock.
    • Output: True/False branch.
    • Notes: Condition checks for Product ID existence.
  • 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.
  • 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 Low flag and Alert 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 Level to 50.
  • Current Stock Update (True Branch, Supabase)

    • Purpose: Updates Supabase Current Stock table.
    • Input: Updated stock JSON.
    • Output: Updated Supabase record.
    • Notes: Matches by Product ID; requires user-configured Supabase credentials.
  • New Row Current Stock (False Branch, Supabase)

    • Purpose: Inserts new product into Supabase Current Stock table.
    • Input: Validated JSON.
    • Output: New Supabase record.
    • Notes: Sets initial stock; requires Supabase credentials.
  • Search Current Stock (Supabase)

    • Purpose: Retrieves Current Stock records for Product ID.
    • Input: JSON with Product ID.
    • Output: JSON array of matching records.
    • Notes: Uses returnAll: true.
  • New Record Raw (Supabase)

    • Purpose: Inserts raw material record into Supabase Raw Materials table.
    • Input: Calculated JSON.
    • Output: New Supabase record.
    • Notes: Auto-maps input data.
  • 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 Requested is a positive number.
    • Input: Standardized JSON.
    • Output: Validated JSON or error.
    • Notes: JavaScript validation.
  • Verify Requested Quantity

    • Purpose: Validates additional fields like Product ID and Submission ID.
    • Input: Validated JSON.
    • Output: Further validated JSON or error.
    • Notes: Ensures data integrity.
  • 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 Stock for Product ID.
    • Input: Appended JSON.
    • Output: JSON with stock data.
    • Notes: Google Sheets lookup.

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 Enough flag (true if Current 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, and Approval 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 Date to 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, and Approved 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 Stock before updating.
    • Input: Approved JSON.
    • Output: JSON with stock data.
    • Notes: Google Sheets lookup.
  • 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.
  • 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 Low flag and Alert 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 By and Approval Date if 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 Issued table.
    • Input: Verified JSON.
    • Output: New Supabase record.
    • Notes: Auto-maps data; requires user-configured credentials.
  • Search Stock by Product ID (Supabase)

    • Purpose: Retrieves Current Stock records.
    • Input: JSON with Product ID.
    • Output: JSON array of records.
    • Notes: Filters by Product ID.
  • Issues Table Update (Supabase, True/False Branch)

    • Purpose: Updates Supabase Materials Issued table.
    • Input: Approval action JSON.
    • Output: Updated Supabase record.
    • Notes: Matches by Submission ID.
  • Update Current Stock (Supabase, True Branch)

    • Purpose: Updates Supabase Current Stock table.
    • Input: Updated stock JSON.
    • Output: Updated Supabase record.
    • Notes: Matches by Product ID.
  • 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.

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

More in Data & databases