Handle order status webhooks with Microsoft SQL Server and email
Quick Overview This workflow receives order status updates via a webhook, validates and normalizes the payload, routes by status, and either returns an immediate JSON response or (for rejections) logs activity to Microsoft SQL Server and sends a rejection email via SMTP.
How it works Receives a POST request with an order status update through an n8n webhook. Validates that email, orderId, and newStatus are present and returns a 400 JSON error response if any required fields are missing. Normalizes the payload into consistent fields (including a timestamp and formatted rejection reason) and routes processing based on newStatus. For Approved, Pending, and Completed statuses, returns a 200 JSON response confirming the status handling. For Rejected status, generates an HTML rejection email, inserts rejection and email logs into Microsoft SQL Server, sends the email via SMTP, and returns a 200 JSON success response.
Setup Enable the webhook trigger and set the webhook path, then copy the production webhook URL into the system that sends order status updates. Add Microsoft SQL Server credentials and ensure the ActivityLogs and EmailLogs tables (and referenced columns) match the INSERT queries used by the workflow. Add an SMTP/email credential for the email-sending step and set the fromEmail address to a valid sender.
Related Templates
AI Email Classifier & Auto-Delete for Gmail (SPAM/OFFER Cleaner)
This workflow is designed for freelancers, solopreneurs, and business owners who receive a high volume of irrelevant mes...
Generate Food Recipes from Gmail & Form Requests with Ollama & Llama 3.2
This n8n template demonstrates how to create an intelligent food recipe assistant that accepts requests via Gmail and we...
Automatic News Summarization & Email Digest with GPT-4, NewsAPI and Gmail
📰 AI News Digest Agent: Auto News Summarizer & Email Newsletter Create an intelligent news curation system that automat...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments