{"product_id":"n8n-workflow-gmail-webhook-automation-with-code-switch","title":"n8n Workflow: Gmail Webhook Automation with Code \u0026 Switch","description":"\u003ch3\u003eAutomate Gmail intake using a Webhook, with Code + Switch logic in n8n\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow turns incoming \u003cstrong\u003ewebhook\u003c\/strong\u003e requests into structured \u003cstrong\u003eGmail-driven automation\u003c\/strong\u003e using a combination of \u003cstrong\u003eCode\u003c\/strong\u003e and \u003cstrong\u003eSwitch\u003c\/strong\u003e logic—so you can route, format, and act on events reliably without manual steps.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReceives data via Webhook:\u003c\/strong\u003e it listens for incoming HTTP payloads and triggers the workflow when a request is received.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eEvaluates conditions with If:\u003c\/strong\u003e it checks the payload using an \u003cstrong\u003eif\u003c\/strong\u003e node to determine whether the next action should proceed.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eTransforms\/derives data in Code:\u003c\/strong\u003e the \u003cstrong\u003ecode\u003c\/strong\u003e node formats or computes the fields needed for downstream steps.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRoutes with Switch:\u003c\/strong\u003e it uses \u003cstrong\u003eswitch\u003c\/strong\u003e to branch logic based on the processed input, enabling different handling paths for different values.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSends actions to Gmail:\u003c\/strong\u003e using the \u003cstrong\u003egmail\u003c\/strong\u003e node, the workflow performs the relevant Gmail operation based on the routing outcome.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSaaS notifications:\u003c\/strong\u003e when an external system calls your webhook, send targeted updates through Gmail based on request type.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOps triage:\u003c\/strong\u003e route incoming events (e.g., “urgent” vs “normal”) and trigger different Gmail actions accordingly.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eTeam request handling:\u003c\/strong\u003e standardize webhook payloads in \u003cstrong\u003eCode\u003c\/strong\u003e and then use \u003cstrong\u003eSwitch\u003c\/strong\u003e to direct different email workflows.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003en8n workflow nodes:\u003c\/strong\u003e if, set, code, gmail, switch, webhook\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eKey components:\u003c\/strong\u003e Webhook trigger → conditional logic (if) → data processing (code + set) → branching (switch) → Gmail action\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eDesigned for n8n users, automation engineers, and SaaS operators who want practical Gmail automation with clear routing and programmable input handling.\u003c\/p\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46232445321395,"sku":"N8N-21025","price":12.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/uXc8DFhBdYFXl9AxPkJ7_4rq51gHK.png?v=1792142611","url":"https:\/\/buyflowscripts.com\/products\/n8n-workflow-gmail-webhook-automation-with-code-switch","provider":"N8N Commerce","version":"1.0","type":"link"}