HomeShopifyShopify Order AI Risk Alerts to…
Shopify

Shopify Order AI Risk Alerts to Slack and Telegram with n8n (Template Inside)

TL;DR: Every new Shopify order posts to Slack and Telegram with the customer’s lifetime value, order count, and a one-line AI risk flag (“repeat customer, low risk” / “first order, high value — confirm shipping address” / “multiple disputes on file”). Your fulfillment team sees the context before they ship. Full n8n workflow below, all using tools you probably already have.

Shopify’s native “new order” email is useless for a busy store. It doesn’t tell you if the customer is a VIP or a chargeback risk. You end up opening Shopify, clicking the customer, checking their history, reading notes — every single order. For a store doing 20+ orders a day, that’s an hour of clicks nobody has time for.

This workflow replaces that with a 5-second glance at Slack or Telegram.

What this workflow does

A new order hits Shopify. n8n picks it up via webhook, pulls the customer’s full history (order count, total spent, prior disputes, last order date), feeds all that to GPT-4o with a short prompt, gets back a one-line risk summary, and posts a clean message to Slack and a matching one to Telegram. Everything is logged to Google Sheets for later analysis.

Example Slack message the workflow produces:

🟢 Order #1247 — $189.00
Sarah Chen · Toronto, CA · sarah@example.com
Products: Linen shirt (M) × 1, Canvas tote × 2
Customer: 4th order, $712 LTV, no disputes
AI flag: Repeat customer, low risk, standard fulfillment

For a risky order:

🟡 Order #1248 — $640.00
Unknown buyer · Lagos, NG · protonmail address
Customer: First order, high value
AI flag: High order value from new customer with anonymous email. Recommend address verification before shipping.

Why this beats Shopify’s default order email

  • Context at a glance — LTV, order history, and risk in one line. No clicking into Shopify.
  • Two channels, one workflow — Slack for the team, Telegram for the owner’s phone. Both get the same data formatted correctly for each platform.
  • AI that actually thinks — GPT-4o reads the customer history and writes a human-sounding flag. Not a rule engine. It catches patterns rigid rules miss.
  • Paper trail — every order gets logged to Google Sheets with the AI flag. You can audit later why a dispute happened.
  • Free to run — Shopify API is free, Slack webhooks are free, Telegram bots are free, Google Sheets is free. Only OpenAI costs money: roughly $0.0008 per order using gpt-4o-mini.

What you need before starting

  • Shopify store with Admin API access
  • n8n instance (Cloud or self-hosted)
  • OpenAI API key (any paid plan; gpt-4o-mini is recommended for cost)
  • Slack workspace with permission to add an Incoming Webhook
  • Telegram bot (takes 2 minutes to create via @BotFather)
  • Google Sheet for logging

The workflow, node by node

  1. Shopify Trigger — topic: orders/create
  2. Shopify node — get the customer by ID (orders/create payload has customer_id)
  3. Edit Fields (Set) — build a compact JSON of order + customer history
  4. OpenAI node — ask gpt-4o-mini for a one-line risk assessment
  5. Edit Fields — format the Slack message (Markdown)
  6. Slack node — post to #orders channel
  7. Edit Fields — format the Telegram message (HTML)
  8. Telegram node — send to the owner’s chat
  9. Google Sheets node — append row with order ID, customer, total, AI flag, timestamp
  10. Error Trigger — separate branch, sends failures to Telegram so nothing fails silently

Ten nodes. One webhook. No custom code.

How to build the Shopify order AI risk workflow in n8n

1. Create Shopify API credentials

  1. In Shopify admin go to Settings → Apps and sales channels → Develop apps.
  2. Click Create an app, name it n8n order alerts.
  3. Under Admin API access scopes enable: read_orders, read_customers.
  4. Install the app. Copy the Admin API access token.

2. Add the Shopify Trigger in n8n

  1. New workflow → add Shopify Trigger node.
  2. Add Shopify credential: shop subdomain (yourstore.myshopify.com) + access token.
  3. Set Topic: orders/create.
  4. Activate. n8n registers the webhook with Shopify automatically.

3. Fetch the customer’s full history

The orders/create payload gives you the customer_id but not the full profile. Add a Shopify node:

  • Resource: Customer
  • Operation: Get
  • Customer ID: {{ $json.customer.id }}

This returns orders_count, total_spent, created_at, tags, addresses, and email — all the history you need.

4. Build the context object for the AI

Add an Edit Fields (Set) node. Keep Mode: Manual Mapping. Build these fields:

order_id        = {{ $('Shopify Trigger').item.json.name }}
order_total     = {{ $('Shopify Trigger').item.json.total_price }}
items           = {{ $('Shopify Trigger').item.json.line_items.map(i => i.title + ' x ' + i.quantity).join(', ') }}
customer_name   = {{ $json.first_name + ' ' + $json.last_name }}
customer_email  = {{ $json.email }}
customer_city   = {{ $json.default_address?.city || 'n/a' }}
customer_country= {{ $json.default_address?.country_code || 'n/a' }}
orders_count    = {{ $json.orders_count }}
lifetime_value  = {{ $json.total_spent }}
customer_since  = {{ $json.created_at }}
customer_tags   = {{ $json.tags }}

5. Ask the AI for a risk flag

Add an OpenAI node. Resource: Text → Message a Model. Model: gpt-4o-mini.

System message:

You are a fulfillment assistant for a Shopify store. Given a new order and the customer's history, write ONE line (max 25 words) describing the risk level and any action the shipping team should take. Use plain language. Start with one of: "Repeat customer, low risk" / "First order" / "High-value order" / "Unusual pattern". Never invent data not present in the input.

User message:

Order: {{$json.order_id}} — {{$json.order_total}} — {{$json.items}}
Customer: {{$json.customer_name}} ({{$json.customer_email}}) from {{$json.customer_city}}, {{$json.customer_country}}
History: {{$json.orders_count}} previous orders, ${{$json.lifetime_value}} lifetime. Customer since {{$json.customer_since}}.
Tags: {{$json.customer_tags}}

Keep temperature at 0.3 — you want consistent output, not creativity.

6. Format and post to Slack

Add a Slack node. Authentication: either OAuth or an Incoming Webhook URL (simpler). Channel: #orders. Message format (Slack mrkdwn):

🟢 *Order {{$('Set context').item.json.order_id}}* — ${{$('Set context').item.json.order_total}}
{{$('Set context').item.json.customer_name}} · {{$('Set context').item.json.customer_city}}, {{$('Set context').item.json.customer_country}} · {{$('Set context').item.json.customer_email}}
Products: {{$('Set context').item.json.items}}
Customer: {{$('Set context').item.json.orders_count}} orders, ${{$('Set context').item.json.lifetime_value}} LTV
AI flag: *{{$('OpenAI').item.json.message.content}}*

7. Send to Telegram too

Create a Telegram bot with @BotFather, get the token, add your chat as a recipient (send /start to the bot, then grab chat_id from https://api.telegram.org/bot<TOKEN>/getUpdates).

Add a Telegram node → Send Message. Parse mode: HTML. Body:

🟢 <b>Order {{$('Set context').item.json.order_id}}</b> — ${{$('Set context').item.json.order_total}}
{{$('Set context').item.json.customer_name}} · {{$('Set context').item.json.customer_city}}
{{$('Set context').item.json.items}}
<b>AI:</b> {{$('OpenAI').item.json.message.content}}

8. Log to Google Sheets

Add a Google Sheets → Append Row node. Columns: timestamp, order_id, customer_email, country, order_total, orders_count, ltv, ai_flag. This is your audit log and the basis for later analysis — dispute patterns, country-level risk, AI flag accuracy.

9. Handle errors

Create a second workflow start with an Error Trigger. Connect it to a Telegram node that posts ❌ Order alert workflow failed: {{error.message}}. Silent failures on a revenue-critical workflow are how you find out three days later that you’ve shipped 40 risky orders blind.

Common mistakes and how to avoid them

Using the full order JSON as the AI prompt. Shopify order payloads are huge (hundreds of fields). Feeding the whole thing to OpenAI burns tokens and dilutes the model’s focus. Always build a compact context object first — the Set node is non-negotiable.

Letting the AI invent data. Without the “Never invent data not present in the input” line in the system prompt, models occasionally make up prior disputes or tag the wrong country. That instruction fixes it 95% of the time.

Double-firing on order edits. Shopify sends orders/create exactly once, but if you swap the trigger to orders/updated (tempting for tag changes) you’ll get the same alert multiple times. Stay on orders/create for this use case.

Skipping the error branch. OpenAI hiccups. Slack tokens expire. Telegram rate-limits. You need one place where failures surface. Five minutes of setup, hours saved when something breaks.

Cost at realistic volume

  • n8n: $5/month self-hosted, $20 Cloud starter
  • Shopify API: free
  • OpenAI (gpt-4o-mini): ~$0.0008 per order. 1,000 orders/month = $0.80.
  • Slack, Telegram, Google Sheets: free at this volume

Total operating cost for a 1,000-order/month store: roughly $6. You save the fulfillment team 30+ minutes a day. The math is not complicated.

Get the ready-to-import template

Build it from scratch in about 40 minutes if you’ve used n8n before.

Or import the template: Browse all downloads →

Included: cleaned JSON, Setup PDF with screenshots for every step, Credentials Guide PDF covering the Shopify app, OpenAI key, Slack webhook, and Telegram bot, Google Sheets template with the columns pre-created.

If you’d rather have us install it on your store: Single Install — $149. Delivered in 48 hours, tested on your live store, 30-minute walkthrough included.

Frequently asked questions

Does Shopify have built-in AI order risk scoring?

Shopify shows a basic “fraud risk” indicator on orders (low, medium, high) based on internal signals, but it doesn’t push alerts anywhere and the reasoning is a black box. This workflow adds a readable AI explanation plus delivery to Slack and Telegram where your team actually works.

Will the AI ever flag a good customer as risky?

Occasionally. The workflow is advisory, not enforcing — it adds context to a Slack message, it doesn’t block or cancel orders. Your team still makes the call. Review the Google Sheets log weekly and refine the system prompt if you see a pattern.

Can I use a cheaper model than gpt-4o-mini?

Yes. The prompt works with any capable instruction-following model — Gemini 1.5 Flash, Claude 3.5 Haiku, or a local Llama via Ollama. At gpt-4o-mini prices, switching isn’t worth the setup time for most stores.

Can this run on n8n Cloud?

Yes. Every node used is standard. No community nodes required. On n8n Cloud’s Starter plan, 1,000 orders a month fits comfortably inside the execution limit.

What if I don’t use Slack?

Remove the Slack node, keep Telegram. Or swap Slack for Discord, Mattermost, or Gmail. The workflow structure is identical — only the final delivery node changes.

Related guides