Shopify + OpenAI: smarter related articles for SEO
Your Shopify blog quietly leaks SEO value when posts don’t point to anything useful. Readers hit the end, bounce, and Google gets one more signal that your content isn’t keeping people around.
Shopify marketers feel it when traffic rises but pages per visit stays flat. SEO leads notice it in crawling and internal link reports. And if you run a small ecommerce team, you’re probably the one doing the “add related posts” cleanup. This Shopify OpenAI SEO automation keeps your blog connected without babysitting every article.
Below, you’ll see how the workflow finds the best matches, updates Shopify automatically, and stays fresh as you publish new content.
How This Automation Works
See how this solves the problem:
n8n Workflow Template: Shopify + OpenAI: smarter related articles for SEO
flowchart LR
subgraph sg0["Schedule Flow"]
direction LR
n0@{ icon: "mdi:play-circle", form: "rounded", label: "Schedule Trigger", pos: "b", h: 48 }
n1@{ icon: "mdi:swap-vertical", form: "rounded", label: "Workflow Configuration", pos: "b", h: 48 }
n2["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Get articles from shopify"]
n3["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Clean & Prepare Text"]
n4@{ icon: "mdi:swap-vertical", form: "rounded", label: "Loop Over Items", pos: "b", h: 48 }
n5["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>OpenAI Get Embeddings"]
n6@{ icon: "mdi:swap-vertical", form: "rounded", label: "Set article fields", pos: "b", h: 48 }
n7["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Calculate similarities"]
n8@{ icon: "mdi:cog", form: "rounded", label: "Upsert articles", pos: "b", h: 48 }
n9@{ icon: "mdi:cog", form: "rounded", label: "Upsert article_relations", pos: "b", h: 48 }
n10["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Top 3 related articles"]
n11@{ icon: "mdi:swap-vertical", form: "rounded", label: "Loop for source articles", pos: "b", h: 48 }
n12@{ icon: "mdi:cog", form: "rounded", label: "Get previous related_articles", pos: "b", h: 48 }
n13@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Check if article already has..", pos: "b", h: 48 }
n14@{ icon: "mdi:cog", form: "rounded", label: "Upsert relations", pos: "b", h: 48 }
n15["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Prepare HTML for related art.."]
n16@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Check if related articles ar..", pos: "b", h: 48 }
n17@{ icon: "mdi:cog", form: "rounded", label: "No need to change the relate..", pos: "b", h: 48 }
n18@{ icon: "mdi:cog", form: "rounded", label: "Get related article details", pos: "b", h: 48 }
n19["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Split Related IDs"]
n20["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Insert Related in Article"]
n21["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Update article with related"]
n4 --> n7
n4 --> n6
n8 --> n4
n0 --> n1
n14 --> n19
n19 --> n18
n6 --> n5
n3 --> n4
n5 --> n8
n7 --> n9
n10 --> n11
n1 --> n2
n11 --> n12
n9 --> n10
n2 --> n3
n20 --> n21
n18 --> n15
n21 --> n11
n12 --> n13
n15 --> n20
n13 --> n16
n13 --> n14
n17 --> n11
n16 --> n17
n16 --> n14
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n0 trigger
class n13,n16 decision
class n2,n5,n21 api
class n3,n7,n10,n15,n19,n20 code
classDef customIcon fill:none,stroke:none
class n2,n3,n5,n7,n10,n15,n19,n20,n21 customIcon
The Challenge: Related posts that never stay relevant
“Related articles” sounds simple until you try to maintain it at scale. You publish new posts, old posts become outdated, and suddenly your “related” section is linking to whatever someone picked months ago. Then it gets worse: different writers follow different rules, someone pastes a block with the wrong CSS class, and now half your posts have duplicate related sections or none at all. It’s not just annoying. It’s lost internal link equity, shorter sessions, and more manual QA every time you refresh content.
The friction compounds. Here’s where it breaks down.
- Manual “pick three links” decisions turn into a recurring editing job that never ends once your blog passes a few dozen posts.
- Old related blocks stick around, so posts end up with two “related articles” sections or links that no longer match the content.
- Teams forget to update internal links after a new cornerstone post launches, which means your best content doesn’t get distributed traffic.
- Rules-based tagging helps a bit, but it misses nuance (and it breaks the moment categories get messy).
The Fix: Auto-insert context-aware related articles in Shopify
This workflow pulls every published post from a selected Shopify blog using the Admin API, then cleans each article so it can “read” the real content instead of your theme markup. It removes any existing .related-articles block, extracts the text, and generates OpenAI embeddings using text-embedding-3-small. Those embeddings get stored in n8n Data Tables so you’re not re-processing everything from scratch every run. From there, the workflow calculates semantic similarity (cosine distance) between articles, selects the top three matches, and builds a fresh HTML “Related articles” section. Finally, it updates each Shopify article automatically, on a weekly schedule, so new posts start influencing the network without you touching anything.
The workflow starts on a schedule (weekly by default). It fetches Shopify articles, generates and stores embeddings, then computes similarity to identify the best matches. At the end, it injects a consistent related section and pushes the update back to Shopify.
What Changes: Before vs. After
| What This Eliminates | Impact You’ll See |
|---|---|
|
|
Real-World Impact
Say your Shopify blog publishes 5 posts a week and you keep a backlog of 120 older posts. Manually adding and checking three related links takes maybe 10 minutes per post, plus another 5 minutes to make sure you didn’t duplicate a block, so you’re spending about 1–2 hours a week just on “related” housekeeping. With this workflow, you trigger nothing; the schedule runs weekly, rebuilds the top 3 matches, and updates posts only when relations actually changed. Your time drops to near-zero, and the blog stays woven together.
Requirements
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Shopify Admin API to read and update blog articles.
- OpenAI API for embeddings and content similarity.
- Shopify Admin API access token (create a custom app in Shopify admin).
Skill level: Intermediate. You’ll paste API keys, set a few environment variables, and test on a small blog first.
Need help implementing this? Talk to an automation expert (free 15-minute consultation).
The Workflow Flow
A weekly schedule kicks it off. The default trigger runs every week at 20:00, but you can change it to daily while you’re rolling out a new blog strategy.
Shopify articles are pulled and cleaned. The workflow retrieves all published posts from the chosen Shopify blog, removes any existing .related-articles section, then extracts readable text so the matching is based on actual content.
OpenAI creates embeddings, then n8n compares them. Each article is converted into an embedding via OpenAI (text-embedding-3-small), stored in n8n Data Tables, and compared using cosine similarity to find the closest matches.
Related HTML is built and injected back into Shopify. The workflow selects the top 3 related articles (configurable), builds a consistent HTML block, checks whether the relations changed, and only then updates the Shopify article through the Admin API.
You can easily modify the number of related links from 3 to 5 based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Schedule Trigger
Set the workflow to run on a weekly schedule so it can fetch and update Shopify blog articles automatically.
- Add and open Planned Schedule Start.
- Set the trigger rule to run weekly by confirming the interval uses weeks and set triggerAtHour to
20. - Keep the output connected to Workflow Settings to initialize environment values before API calls.
Step 2: Connect Shopify and Define Workflow Settings
Provide Shopify details and connect the Shopify credential to both read and update posts.
- Open Workflow Settings and set shopifyBlogId to your blog ID (currently empty).
- Set shopifyBlogDomain to
https://example.com/blogs/(replace with your live blog domain). - Set shopifyStoreName to
<domain_before_myshopify.com>and shopApiVersion to2025-07. - Set percent_minimum_similarity to
70to control the similarity threshold. - Open Retrieve Shopify Posts and confirm the URL is
=https://{{ $('Workflow Settings').first().json.shopifyStoreName }}.myshopify.com/admin/api/{{ $('Workflow Settings').first().json.shopApiVersion }}/blogs/{{ $('Workflow Settings').first().json.shopifyBlogId }}/articles.json. - In Retrieve Shopify Posts, keep the query parameter published_status set to
published. - Credential Required: Connect your shopifyAccessTokenApi credentials in Retrieve Shopify Posts.
- Open Update Shopify Article and confirm the URL is
=https://{{ $('Workflow Settings').first().json.shopifyStoreName }}.myshopify.com/admin/api/{{ $('Workflow Settings').first().json.shopApiVersion }}/blogs/{{ $('Workflow Settings').first().json.shopifyBlogId }}/articles/{{ $json.article.id }}.json. - Credential Required: Connect your shopifyAccessTokenApi credentials in Update Shopify Article.
Step 3: Normalize, Map, and Embed Article Content
Clean the article HTML, map fields for storage, and generate embeddings using OpenAI.
- Review Normalize Article Text to ensure it removes existing related sections and produces text_for_embedding.
- In Map Article Fields, confirm the mapping values use expressions like
{{ $json.shopify_id }},{{ $json.title }}, and{{ $json.content }}. - Set embedding to
{{ $json.text_for_embedding }})and analyzed_at to{{new Date().toISOString()}}in Map Article Fields. - Open OpenAI Embedding Request and set URL to
https://api.openai.com/v1/embeddingsand Method toPOST. - In OpenAI Embedding Request, set model to
text-embedding-3-smalland input to{{ $json.embedding }}. - Credential Required: Connect your openAiApi credentials in OpenAI Embedding Request.
{{ $json.text_for_embedding }}.Step 4: Store Articles and Build Similarity Relations
Persist article data, calculate similarity, and save relation records. This is where the data table operations and similarity logic happen.
- In Upsert Article Records, confirm Operation is
upsertand Match Type isallConditions, with filter shopify_id set to{{ $('Map Article Fields').item.json.shopify_id }}. - Ensure the embedding is saved using
{{ JSON.stringify($json.data[0].embedding) }}in Upsert Article Records. - Iterate Records outputs to both Compute Similarity Scores and Map Article Fields in parallel.
- In Compute Similarity Scores, verify the similarity filter uses
{{ $('Workflow Settings').first().json.percent_minimum_similarity }}. - In Upsert Relation Records, keep Operation set to
upsertand map fields like{{ $json.source_shopify_id }}and{{ $json.related_shopify_id }}.
Step 5: Select Related Articles and Update Shopify Content
Choose the top related articles, compare existing relations, build HTML, and update Shopify posts only when changes are detected.
- Confirm Select Top Related returns the top 3 IDs per article and passes them to Iterate Source Articles.
- Use Fetch Prior Relations and Check Existing Relations to detect whether a previous snapshot exists for the article.
- In Compare Relation Lists, ensure it compares
{{ $('Iterate Source Articles').item.json.related_shopify_ids.join() }}to{{ $('Fetch Prior Relations').item.json.related_shopify_ids }}. - Allow the Skip Update Section path to bypass updates when relations have not changed.
- When changes exist, store the latest IDs in Save Relation Snapshot and expand with Expand Related IDs.
- Use Fetch Related Details and Build Related HTML to generate the related articles HTML block.
- In Inject Related Section, ensure the old related block is removed and the new block is appended to the article body.
- In Update Shopify Article, keep JSON Body set to
{{ JSON.stringify($json) }}and Method toPUT.
Step 6: Test and Activate Your Workflow
Run a manual test to verify embeddings, relation storage, and Shopify updates, then activate the schedule.
- Click Execute Workflow to run from Planned Schedule Start.
- Confirm Retrieve Shopify Posts returns published articles and Normalize Article Text outputs clean text.
- Verify OpenAI Embedding Request returns embeddings and Upsert Article Records writes rows.
- Check that Compute Similarity Scores produces relation items and Upsert Relation Records stores them.
- Validate that updated articles in Shopify include the related articles block after Update Shopify Article.
- When satisfied, toggle the workflow to Active so Planned Schedule Start runs weekly.
Watch Out For
- Shopify Admin API credentials can expire or need specific permissions. If things break, check your custom app scopes and token status in Shopify admin first.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.
Common Questions
About an hour if your Shopify and OpenAI keys are ready.
Yes, but someone should be comfortable creating a Shopify custom app and pasting API keys into n8n. After that, it’s mostly configuring variables and testing on a small set of posts.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenAI API costs for embeddings, which are usually low but depend on how many posts you process.
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
You can tune it without rewriting the whole thing. Most teams start by changing the similarity threshold (the workflow uses a percent_minimum_similarity setting, default 70) and the “Top 3” selection so it shows 4–5 links on longer posts. If your theme uses different markup, swap the CSS class in the “clean HTML” and “build related HTML” parts so it removes and injects the right block. You can also keep the matching as-is and add a second OpenAI step that rewrites link titles or adds one-line summaries for a nicer UX.
Usually it’s the Admin API token or scopes. Regenerate the Shopify Admin API access token in your custom app and confirm it has permission to read and write blog articles. Also double-check the workflow environment variables like store domain and API version, because one wrong value can make every HTTP request look “fine” but return nothing. If you’re processing a lot of posts in one run, you may also be hitting Shopify rate limits, so slowing batches down can help.
In practice it scales with how many articles you have and how fast your n8n instance can run the batches. On n8n Cloud, the Starter plan supports a set number of monthly executions and the higher tiers handle more; this workflow will use multiple executions per run if you have lots of posts. If you self-host, you’re not capped by executions, but you are capped by server resources and API limits (Shopify and OpenAI). For many small Shopify blogs, weekly runs are comfortable on a modest VPS.
Often, yes, because the core value here is the logic: storing embeddings, calculating similarity, comparing relation snapshots, and only updating Shopify when something changed. n8n is built for that kind of multi-step workflow and it’s easier to self-host when executions climb. Zapier or Make can work if you simplify the approach (for example, “choose from a tagged list”), but you’ll lose the semantic matching that makes this feel smart. If you’re unsure, Talk to an automation expert and we’ll sanity-check the best path.
Once this is running, your Shopify blog stops behaving like a pile of separate posts and starts acting like a connected library. Honestly, that’s the difference between “we publish” and “we compound.”
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.