AutomationFlowsAI & RAG › Send Shopify AI Order Confirmations with Claude Sonnet and Gmail

Send Shopify AI Order Confirmations with Claude Sonnet and Gmail

BySwapnil Mandloi @swapnil-mandloi on n8n.io

This workflow triggers on new Shopify orders, uses Anthropic Claude to generate a personalized HTML order confirmation with one relevant upsell suggestion, then emails the customer via Gmail and logs the order details and upsell note to an n8n Data Table. Triggers when Shopify…

Event trigger★★★★☆ complexityAI-powered15 nodesShopify TriggerAgentAnthropic ChatOutput Parser StructuredData TableGmail
AI & RAG Trigger: Event Nodes: 15 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #17577 — we link there as the canonical source.

This workflow follows the Agent → Datatable recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "pHrumXa9CBMyoSgC",
  "name": "Shopify Order Responder \u2014 AI Confirmation + Smart Upsell",
  "tags": [],
  "nodes": [
    {
      "id": "bb726b2f-7c59-4946-bd9f-1f7badae3c19",
      "name": "New Order",
      "type": "n8n-nodes-base.shopifyTrigger",
      "position": [
        -1280,
        352
      ],
      "parameters": {
        "topic": "orders/create",
        "authentication": "accessToken"
      },
      "typeVersion": 1
    },
    {
      "id": "53c1198c-9fb3-43e8-802d-94a12576a026",
      "name": "Normalize Order",
      "type": "n8n-nodes-base.set",
      "position": [
        -816,
        352
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "o_num",
              "name": "order_number",
              "type": "string",
              "value": "={{ ($json.order_number ?? $json.name ?? \"\").toString() }}"
            },
            {
              "id": "o_name",
              "name": "customer_name",
              "type": "string",
              "value": "={{ $json.customer?.first_name ?? \"there\" }}"
            },
            {
              "id": "o_email",
              "name": "email",
              "type": "string",
              "value": "={{ $json.email ?? $json.contact_email ?? \"\" }}"
            },
            {
              "id": "o_total",
              "name": "total",
              "type": "string",
              "value": "={{ ($json.currency ?? \"USD\") + \" \" + ($json.total_price ?? \"0\") }}"
            },
            {
              "id": "o_items",
              "name": "items",
              "type": "string",
              "value": "={{ ($json.line_items ?? []).map(i => i.quantity + \"x \" + i.title).join(\", \") }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "70f57dc9-7ee1-4ee6-86aa-d238dc7ed56b",
      "name": "AI Order Confirmation",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -480,
        352
      ],
      "parameters": {
        "text": "=Write an order confirmation with a subtle relevant upsell.\n\nCustomer: {{ $json.customer_name }}\nOrder: {{ $json.order_number }}\nTotal: {{ $json.total }}\nItems: {{ $json.items }}",
        "options": {
          "systemMessage": "You write warm e-commerce order confirmations. response_subject includes the order number and first name. response_message is clean HTML (<p> paragraphs) that thanks the customer, confirms the items and total, and adds ONE natural, genuinely relevant product suggestion based on what they bought (no pushy discounts, no fake scarcity). upsell_note is one internal line describing the suggestion you made. Never invent shipping dates, tracking numbers, or prices. Return ONLY the JSON object."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "id": "a160940f-ed6b-44cc-9b5f-931783fb6cdf",
      "name": "Claude Sonnet 4.6",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        -480,
        576
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-6",
          "cachedResultName": "Claude Sonnet 4.6"
        },
        "options": {
          "temperature": 0.5,
          "maxTokensToSample": 800
        }
      },
      "typeVersion": 1.5
    },
    {
      "id": "8acd2ceb-d0c5-441c-8ff4-b0788726dce1",
      "name": "Order Schema",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -336,
        576
      ],
      "parameters": {
        "jsonSchemaExample": "{ \"response_subject\": \"Your order #1042 is confirmed, Anita\", \"response_message\": \"<p>Hi Anita,</p><p>Thanks for your order!</p>\", \"upsell_note\": \"Suggested a protective case to complement the earbuds.\" }"
      },
      "typeVersion": 1.3
    },
    {
      "id": "3359c4cc-cf97-4aa0-a1a0-213f824b2d23",
      "name": "Shape Order",
      "type": "n8n-nodes-base.set",
      "position": [
        48,
        352
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "so_num",
              "name": "order_number",
              "type": "string",
              "value": "={{ $(\"Normalize Order\").item.json.order_number }}"
            },
            {
              "id": "so_name",
              "name": "customer_name",
              "type": "string",
              "value": "={{ $(\"Normalize Order\").item.json.customer_name }}"
            },
            {
              "id": "so_email",
              "name": "email",
              "type": "string",
              "value": "={{ $(\"Normalize Order\").item.json.email }}"
            },
            {
              "id": "so_total",
              "name": "total",
              "type": "string",
              "value": "={{ $(\"Normalize Order\").item.json.total }}"
            },
            {
              "id": "so_items",
              "name": "items",
              "type": "string",
              "value": "={{ $(\"Normalize Order\").item.json.items }}"
            },
            {
              "id": "so_subj",
              "name": "response_subject",
              "type": "string",
              "value": "={{ $json.response_subject }}"
            },
            {
              "id": "so_msg",
              "name": "response_message",
              "type": "string",
              "value": "={{ $json.response_message }}"
            },
            {
              "id": "so_up",
              "name": "upsell_note",
              "type": "string",
              "value": "={{ $json.upsell_note }}"
            },
            {
              "id": "so_ts",
              "name": "logged_at",
              "type": "string",
              "value": "={{ $now.toISO() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "00c1e0c6-e8b2-4e27-82bf-e8810e1b7a16",
      "name": "Log Order",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        272,
        176
      ],
      "parameters": {
        "columns": {
          "value": {
            "email": "={{ $(\"Shape Order\").item.json.email }}",
            "items": "={{ $(\"Shape Order\").item.json.items }}",
            "total": "={{ $(\"Shape Order\").item.json.total }}",
            "logged_at": "={{ $(\"Shape Order\").item.json.logged_at }}",
            "upsell_note": "={{ $(\"Shape Order\").item.json.upsell_note }}",
            "order_number": "={{ $(\"Shape Order\").item.json.order_number }}",
            "customer_name": "={{ $(\"Shape Order\").item.json.customer_name }}"
          },
          "schema": [
            {
              "id": "order_number",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "order_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "customer_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "customer_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "total",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "items",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "items",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "upsell_note",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "upsell_note",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "logged_at",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "logged_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow"
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "name",
          "value": "order_log"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "be1ca694-6f00-41fe-b65c-964c8553d3a9",
      "name": "Email Confirmation",
      "type": "n8n-nodes-base.gmail",
      "onError": "continueRegularOutput",
      "maxTries": 3,
      "position": [
        368,
        592
      ],
      "parameters": {
        "sendTo": "={{ $(\"Shape Order\").item.json.email }}",
        "message": "={{ $(\"Shape Order\").item.json.response_message }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "={{ $(\"Shape Order\").item.json.response_subject }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "typeVersion": 2.2,
      "waitBetweenTries": 2000
    },
    {
      "id": "fde4fea9-4e5d-43aa-8bbe-2c4c26af1b42",
      "name": "Sticky Note 6c1c2dec",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1888,
        -80
      ],
      "parameters": {
        "color": 4,
        "width": 504,
        "height": 472,
        "content": "## \ud83d\uded2 Shopify Order Responder\n\nWhen a new Shopify order comes in, AI sends a warm, personalized confirmation with ONE genuinely relevant product suggestion \u2014 and logs the order with the upsell for tracking.\n\n**Flow:** New order \u2192 Normalize \u2192 AI confirmation \u2192 Shape \u2192 log + email.\n\n### Setup\n1. Connect **Shopify**, **Anthropic**, and **Gmail** credentials.\n2. Activate \u2014 Shopify registers the webhook automatically.\n3. Place a test order to see it run."
      },
      "typeVersion": 1
    },
    {
      "id": "cd01319a-6d54-47d9-a4f0-b5bdabf07eb1",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1344,
        720
      ],
      "parameters": {
        "width": 336,
        "height": 224,
        "content": "### \ud83d\udfe2 New Order\n**Type:** Shopify Trigger\n**Function:** Listens for new incoming orders from your Shopify store and kicks off the workflow automatically."
      },
      "typeVersion": 1
    },
    {
      "id": "7119ea69-438c-4eba-b252-73f3647bbf52",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -896,
        720
      ],
      "parameters": {
        "width": 320,
        "height": 224,
        "content": "### \ud83d\udee0\ufe0f Normalize Order\n**Type:** Data Manipulation (Manual/Code)\n**Function:** Cleans up, filters, or structures the raw incoming Shopify order data so the AI can easily understand it."
      },
      "typeVersion": 1
    },
    {
      "id": "39c4e93f-c248-4d32-8329-9ad6872deaa7",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        720
      ],
      "parameters": {
        "width": 432,
        "height": 304,
        "content": "### \ud83e\udd16 AI Order Confirmation\n**Type:** AI Agent\n**Function:** The brain of the workflow. Generates the warm confirmation email and smart upsell. \n**Connected Sub-nodes:**\n- Chat Model: Claude Sonnet 4.6\n- Memory\n- Tool\n- Output Parser: Order Schema"
      },
      "typeVersion": 1
    },
    {
      "id": "d6495147-2210-4b7c-99fb-7f69a84bf373",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        720
      ],
      "parameters": {
        "width": 304,
        "height": 288,
        "content": "### \ud83d\udcd0 Shape Order\n**Type:** Data Manipulation (Manual/Code)\n**Function:** Takes the parsed output from the AI and maps it into the exact fields required for the logging and emailing steps."
      },
      "typeVersion": 1
    },
    {
      "id": "0ff5809b-c8e3-4f6b-8929-d47559608321",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        112
      ],
      "parameters": {
        "width": 304,
        "height": 256,
        "content": "### \ud83d\udcca Log Order\n**Type:** Spreadsheet/Database (e.g., Google Sheets or Airtable)\n**Function:** Records the order details, customer info, and the specific upsell product the AI recommended for future tracking."
      },
      "typeVersion": 1
    },
    {
      "id": "9f60534b-b201-4aa2-9221-2606d40f5513",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        720
      ],
      "parameters": {
        "width": 304,
        "height": 256,
        "content": "### \u2709\ufe0f Email Confirmation\n**Type:** Gmail (Action: Send Message)\n**Function:** Sends the final, personalized AI-generated confirmation and upsell email directly to the customer."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "67219eaa-4cad-4031-8170-61815e000361",
  "nodeGroups": [],
  "connections": {
    "New Order": {
      "main": [
        [
          {
            "node": "Normalize Order",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shape Order": {
      "main": [
        [
          {
            "node": "Log Order",
            "type": "main",
            "index": 0
          },
          {
            "node": "Email Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Order Schema": {
      "ai_outputParser": [
        [
          {
            "node": "AI Order Confirmation",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Order": {
      "main": [
        [
          {
            "node": "AI Order Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude Sonnet 4.6": {
      "ai_languageModel": [
        [
          {
            "node": "AI Order Confirmation",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Order Confirmation": {
      "main": [
        [
          {
            "node": "Shape Order",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow triggers on new Shopify orders, uses Anthropic Claude to generate a personalized HTML order confirmation with one relevant upsell suggestion, then emails the customer via Gmail and logs the order details and upsell note to an n8n Data Table. Triggers when Shopify…

Source: https://n8n.io/workflows/17577/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow triggers on successful Stripe charges, normalizes payment details, uses Anthropic Claude to generate a personalized thank-you and receipt message, logs the payment to an n8n Data Table,

Stripe Trigger, Agent, Anthropic Chat +3
AI & RAG

This workflow monitors a Gmail inbox for unread messages, uses Anthropic Claude to classify and summarize each email, auto-drafts an HTML reply in the same thread, logs the triage result to an n8n Dat

Gmail Trigger, Agent, Anthropic Chat +3
AI & RAG

Who is this for? Agencies, consultants, and service providers who conduct discovery calls and need to quickly turn conversations into professional proposals.

Tool Think, Tool Calculator, Agent Tool +18
AI & RAG

This workflow automates end-to-end contract and invoice management using AI intelligence. It processes proposals through intelligent contract generation, approval workflows, and automated invoicing. O

Form Trigger, Data Table, Agent +4
AI & RAG

Automates SaaS operations by consolidating user management, AI-driven support triage, analytics, and billing into one unified system. User signups flow through registration, support requests route via

Form Trigger, Data Table, Agent +7