Quick overview
This workflow receives e-commerce order-risk and inventory/pricing events via a webhook, fetches supporting context from your commerce APIs, asks Anthropic Claude to recommend an action with confidence, optionally auto-executes low-risk actions, logs every decision to Postgres, and notifies the appropriate Slack channel.
How it works
- Receives a POST webhook event (or a manual test event) and applies shared configuration like API base URL, lookback window, thresholds, and Slack channel IDs.
- Normalizes the incoming payload, classifies it as an order-risk or inventory/pricing event, and routes it to the matching evidence-gathering path.
- Fetches domain-specific evidence from your commerce APIs (orders/customer/fraud signals for order risk, or inventory/pricing history/market data for inventory and pricing) and combines the results.
- Sends the event and evidence to Anthropic Claude and parses the returned JSON decision (recommended action, confidence, risk level, reasoning, Slack message, and an execution payload).
- If confidence meets the threshold and risk is not high, calls your commerce API to auto-execute the recommended action; otherwise it skips execution.
- Writes a full audit record of the event, evidence snapshot, decision, and execution status to Postgres and posts a message to Slack using either an escalation channel or a low-noise log channel.
Setup
- Create a webhook source in your commerce/OMS/fraud/inventory system and configure it to POST events to this workflow’s webhook URL.
- Add HTTP Header Auth credentials for both your commerce API requests and the Anthropic API (including the required
anthropic-version header) and update the commerce API base URL and model name in the configuration step.
- Add Postgres credentials and ensure the target audit table (default
control_tower_decisions) exists with columns matching the workflow’s insert fields.
- Add Slack credentials with permission to post messages, then set the low-noise and escalation channel IDs in the configuration step.
- Review and tune the lookback window and the auto-execute confidence threshold to match your risk tolerance and the actions your commerce API supports.