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
- Webhook - New Order Exception
- Manual Trigger - Test Run
- Set - Sample Exception Payload
- Set - Config
- HTTP Request - Fetch Order Details
- HTTP Request - Fetch Customer Profile & History
- HTTP Request - Fetch Inventory & Substitute SKUs
- Merge - Combine Order Context
- JS - Build Decision Context
- HTTP Request - Claude: Decide Resolution Action
- JS - Parse & Validate Decision
- JS - Log Decision (Pre-Execution)
- Switch - Route To Action Executor
- HTTP Request - Execute: Reissue Payment Link
24 steps in total.
Similar automations
Finance, Invoices & AccountingExtract and post supplier invoices with AI, routing exceptions for review16 stepsE-commerce & PaymentsRoute ecommerce risk and inventory decisions with Claude, Postgres, and Slack26 stepsDocuments, PDF & OCRAnalyze invoice exceptions weekly and publish RCA reports with Groq and Notion16 stepsCustomer Support & HelpdeskRoute eCommerce Contact Form Messages by Topic with OpenAI13 steps