Trace refund approval flows with OpenRouter and OpenTelemetry
Quick overview
Description
Quick overview This workflow enriches a refund request, drafts an approval proposal with an AI agent, and waits for a human decision, so you can follow one execution across the wait with OpenTelemetry tracing. It is Exercise 5 from the n8n Production AI Playbook on Audit & Trace. How it works Receives a POST webhook request with a requestId, amount in cents, reason and a traceparent header. Enrich Request Sub-workflow validates the request and adds simulated customer context. Policy Service Call sends an HTTP request that carries the trace context to an echo service. Approval Proposal Agent drafts a proposal using an OpenRouter chat model. Return Approval Request responds with the proposal, executionId and resumeUrl. Wait for Human Approval pauses until a decision is posted to the resume URL. Validate Approval checks the decision and Record Approval saves it. Invalid decisions stop at Reject Approval. Setup Import, save and publish the Exercise 5 enrichment sub-workflow, then select it in Enrich Request Sub-workflow. Add an OpenRouter API credential to OpenRouter - Approval. Optionally enable OpenTelemetry tracing in Settings > OpenTelemetry. Select Execute workflow and POST {"requestId":"REQ-2001","amount":4999,"reason":"duplicate charge"} with a traceparent header. POST {"approved":true,"approver":"Demo reviewer"} to the returned resumeUrl, then search your traces by n8n.execution.id to find both parts of the run. Requirements n8n Cloud or a self-hosted n8n instance An OpenRouter API key The Exercise 5 enrichment sub-workflow A trace viewer such as Jaeger to inspect the spans (optional) Customization Replace Policy Service Call with a call to your own instrumented service so its spans join the same trace. Additional info No payment is processed. The approver field is a demo value. In production, take the reviewer's identity from an authenticated login and protect the resume endpoint. An n8n automation workflow template by Elvis Sarvia.
Community Metrics
Author
Elvis Sarvia
Platform
web
Pricing model
free
Categories
- Automation
- AI
Tags
- n8n
- workflow
- http-request
- ai-agent
- openrouter-chat-model
Capabilities
- 3 nodes