# Shopify multi-module automation with Langchain: n8n workflow

> Started by another system calling it, and works across Email, Google Sheets, Notion, Shopify and two others. It hands the judgement calls to OpenAI.

Source: https://millionrounds.com/workflow/shopify-multi-module-automation-with-langchain (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [E-commerce](https://millionrounds.com/workflows?category=E-commerce#library)

# Shopify multi-module automation with Langchain

Started by another system calling it, and works across Email, Google Sheets, Notion, Shopify and two others. It hands the judgement calls to OpenAI. 78 steps, 6 branches, 3 loops or waits: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fshopify-multi-module-automation-with-langchain)

**78 steps** Large: read it before trusting it with anything live

**6** Branches: places the flow splits

**3** Loops or waits

**6** Services it connects to

## The flow

Starts it 8 Model 26 Logic 12 Service 14

The steps in the order they run, from what starts it. The first 60 of 78.

- 1 **Incoming Message** Webhook *Starts it*
- 2 **Lookup Order API** Http Request *Service*
- 3 **OpenAI Chat Model for Agent** Lm Chat Open Ai *Model*
- 4 **Product Inquiry Webhook** Webhook *Starts it*
- 5 **OpenAI Chat Model for Agent1** Lm Chat Open Ai *Model*
- 6 **Detect Abandoned Cart** Shopify trigger *Starts it*
- 7 **OpenAI Chat Model for Agent2** Lm Chat Open Ai *Model*
- 8 **Hourly Check** Cron *Starts it*
- 9 **OpenAI Chat Model for Agent3** Lm Chat Open Ai *Model*
- 10 **Trigger Restock Webhook** Webhook *Starts it*
- 11 **Order Delivered Trigger** Shopify trigger *Starts it*
- 12 **OpenAI Chat Model for Agent4** Lm Chat Open Ai *Model*
- 13 **Listen for Review Webhook** Webhook *Starts it*
- 14 **Campaign Schedule (e.g., Daily at 9 AM)** Cron *Starts it*
- 15 **OpenAI Chat Model for Agent5** Lm Chat Open Ai *Model*
- 16 **OpenAI Chat Model for Agent6** Lm Chat Open Ai *Model*
- 17 **SearchFAQs** Tool Code *Model*
- 18 **LookupOrderStatus** Tool Code *Model*
- 19 **RefineProductSelection** Tool Code *Model*
- 20 **DetermineDiscount** Tool Code *Model*
- 21 **FormatLowStockReport** Tool Code *Model*
- 22 **DraftReviewRequestEmail** Tool Code *Model*
- 23 **OpenAI Chat Model** Lm Chat Open Ai *Model*
- 24 **GenerateCampaignEmailVariant** Tool Code *Model*
- 25 **SuggestCampaignAdjustments** Tool Code *Model*
- 26 **AnalyzeCampaignPerformance** Tool Code *Model*
- 27 **Preprocess Input for Agent** Function *Logic*
- 28 **Get FAQs Data** Google Sheets *Service*
- 29 **AI Agent** Agent *Model*
- 30 **Summarize Request & Get Filters** Function *Logic*
- 31 **AI Agent1 (Product Selection Refinement)** Agent *Model*
- 32 **Wait Period** Wait *Logic*
- 33 **AI Agent2 (Cart Recovery)** Agent *Model*
- 34 **Fetch Inventory** Shopify *Service*
- 35 **AI Agent3 (Low Stock Reporting)** Agent *Model*
- 36 **Send SMS Alert (Restock)** Twilio *Service*
- 37 **Wait 3 Days** Wait *Logic*
- 38 **AI Agent4 (Review Request Email)** Agent *Model*
- 39 **OpenAI** Open Ai *Model*
- 40 **Fetch Target Audience API** Http Request *Service*
- 41 **AI Agent5 (Campaign Content Generation)** Agent *Model*
- 42 **AI Agent6 (Campaign Adjustment)** Agent *Model*
- 43 **Basic LLM Chain** Chain Llm *Model*
- 44 **Check if Escalation Needed** If *Logic*
- 45 **Search Products API** Http Request *Service*
- 46 **Build Product Carousel** Function *Logic*
- 47 **Fetch Customer Info** Http Request *Service*
- 48 **Create Discount (if applicable)** Shopify *Service*
- 49 **Filter Low Stock (<10)** If *Logic*
- 50 **Notify Slack (Low Stock)** Slack *Service*
- 51 **Fetch Customer Data (for Review)** Http Request *Service*
- 52 **Send Review Request Email** Email Send *Service*
- 53 **Flag Negative Review** If *Logic*
- 54 **Segment Audience Logic** Function *Logic*
- 55 **Prepare Campaign Email** Function *Logic*
- 56 **Adjust Campaign (Implement Suggestions)** Function *Logic*
- 57 **Send restock Request Email1** Email Send *Service*
- 58 **Notify Human Agent** Slack *Service*
- 59 **Send AI Response to Customer** Http Request *Service*
- 60 **Filter Out of Stock** If *Logic*

## How it's built

- **Starts on:** Another system calling it
- **Steps:** 78, with 6 branches, 3 loops or waits
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Email, Google Sheets, Notion, Shopify, Slack, Twilio
- **Model:** OpenAI

## Questions

What does it need to run?

An n8n account, plus your own Email, Google Sheets, Notion, Shopify, Slack and Twilio accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on another system calling it.

Does it use AI?

Yes. It calls OpenAI. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 78 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 78 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fshopify-multi-module-automation-with-langchain)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Email](https://millionrounds.com/workflows?service=Email#library)[Google Sheets](https://millionrounds.com/workflows?service=Google+Sheets#library)[Notion](https://millionrounds.com/workflows?service=Notion#library)[Shopify](https://millionrounds.com/workflows?service=Shopify#library)[Slack](https://millionrounds.com/workflows?service=Slack#library)[Twilio](https://millionrounds.com/workflows?service=Twilio#library)

## Workflows like it

Also e-commerce, with the same services where possible, closest in size first.

- [**Recover Shopify abandoned carts with SMS and WhatsApp** 44 steps · Google Sheets, SendGrid](https://millionrounds.com/workflow/recover-shopify-abandoned-carts-with-sms-and-whatsapp)
- [**Handle WhatsApp orders, FAQs, and tracking with OpenAI** 37 steps · calls a model · Google Drive, Google Sheets](https://millionrounds.com/workflow/handle-whatsapp-orders-faqs-and-tracking-with-openai)
- [**Confirm COD orders and recover carts with Telegram** 33 steps · calls a model · Google Sheets, Slack](https://millionrounds.com/workflow/confirm-cod-orders-and-recover-carts-with-telegram)
- [**Process prescription orders and refills with Telegram** 32 steps · calls a model · Google Sheets, Slack](https://millionrounds.com/workflow/process-prescription-orders-and-refills-with-telegram)
- [**Handle voice food orders with Google Sheets** 32 steps · Google Sheets](https://millionrounds.com/workflow/handle-voice-food-orders-with-google-sheets)
- [**Review and approve Google Sheets orders by email and notify** 28 steps · Gmail, Google Sheets](https://millionrounds.com/workflow/review-and-approve-google-sheets-orders-by-email-and-notify)
