Skip to content
NEWMeet Alaaddin, your AI genie with a voice. trig8n launches 1 January 2027. See what is new

Library / E-commerce & Payments

E-commerce & Payments

Resolve ecommerce order exceptions with Anthropic Claude and Slack

When an API call/webhook arrives, it handles orders and payments with Claude using Slack.

What it does

## AI Order Exception Agent — Policy-Constrained Autonomous Resolution This is an agent that takes real, controlled ACTIONS, not just text. It listens for order exceptions (payment failed, address undeliverable, inventory shortage, fraud-score flagged, carrier delay) from your OMS, gathers order + customer + inventory context, asks Claude to decide the correct resolution action from a strict allow-list of tool calls, and then actually executes that action through real APIs — with every action re-validated in deterministic code against policy limits (max refund/credit amount, fraud hard-stop) before it's allowed to run. ### How it works 1. Webhook - New Order Exception receives the exception event from your OMS (also testable via Manual Trigger + Set - Sample Exception Payload) 2. Set - Config centralizes API URLs and policy limits: maxAutoRefundAmount, maxAutoCreditAmount, requireHumanApprovalAboveAmount, slackEscalationChannelId 3. Three parallel HTTP Request nodes fetch order details, customer profile/history, and inventory/substitute SKUs; Merge - Combine Order Context joins them into one item 4. HTTP Request - Claude: Decide Resolution Action sends that context and forces Claude to choose exactly ONE action from a fixed allow-list (reissue_payment_link, substitute_sku, reroute_carrier, issue_store_credit, refund_order, escalate_to_human) plus the parameters that action needs and its reasoning 5. JS - Parse & Validate Decision parses that safely AND re-validates it against policy — amount ceilings, the fraud-flag hard-stop, and any unknown/disallowed action name all get force-overridden to escalate_to_human. The AI proposes; deterministic code disposes 6. JS - Log Decision (Pre-Execution) writes the decision to the audit trail BEFORE anything runs, so it's on record even if execution fails 7. Switch - Route To Action Executor dispatches to exactly one narrow-scoped API call per allowed action — Claude never gets raw API/database access, only this pre-built menu 8. JS - Merge Execution Result + JS - Log Decision (Post-Execution) record what actually happened against the original decision, completing the audit trail 9. HTTP Request - Notify Customer Of Resolution sends the customer-facing update; escalated cases skip this until a human acts ### How to set up 1. Import this workflow into n8n 2. Add credentials: OMS/order platform API, payment processor API,

The steps

  1. Webhook - New Order Exception
  2. Manual Trigger - Test Run
  3. Set - Sample Exception Payload
  4. Set - Config
  5. HTTP Request - Fetch Order Details
  6. HTTP Request - Fetch Customer Profile & History
  7. HTTP Request - Fetch Inventory & Substitute SKUs
  8. Merge - Combine Order Context
  9. JS - Build Decision Context
  10. HTTP Request - Claude: Decide Resolution Action
  11. JS - Parse & Validate Decision
  12. JS - Log Decision (Pre-Execution)
  13. Switch - Route To Action Executor
  14. HTTP Request - Execute: Reissue Payment Link

24 steps in total.

Similar automations