n8n Integration
This guide shows you how to add FlautoPsy monitoring to your n8n automation workflows.
Step 1: Get Your Webhook URL
- Log in to FlautoPsy at https://flautopsy.stralocroft.com/dashboard
- Go to Settings → Setup (or /setup)
- Copy your unique webhook URL
Step 2: Add an HTTP Request Node
- Open your n8n workflow
- Click + to add a new node
- Search for HTTP Request and select it
- Click Add node
Step 3: Configure the HTTP Request Node
In the HTTP Request node settings:
| Field | Value | |-------|-------| | Request Method | POST | | URL | Paste your FlautoPsy webhook URL | | Content-Type | application/json | | Headers | None required (n8n sets Content-Type automatically) |
Step 4: Set Request Body
Click on the Body tab and switch to JSON mode (if not already selected).
Paste the following JSON template:
json
{ "workflow_id": "your-workflow-name", "prompt": "{{$node.PreviousNode.json.prompt}}", "output": "{{$node.PreviousNode.json.output}}", "latency_ms": {{$node.PreviousNode.json.latencyMs}}, "cost_tokens": {{$node.PreviousNode.json.costTokens}}, "model": "gpt-4"} Mapping n8n Variables
Replace the template variables with outputs from your LLM node:
| Field | n8n Variable | |-------|--------------| | workflow_id | A fixed string, e.g.,
text
"email-classifier"text
{{$node.YourLLMNode.json.prompt}}text
YourLLMNodetext
{{$node.YourLLMNode.json.message}}text
{{$node.YourLLMNode.json.duration}}text
{{add($node.YourLLMNode.json.usage.prompt_tokens, $node.YourLLMNode.json.usage.completion_tokens)}}text
"gpt-4"Example with OpenAI Node
If your workflow includes an OpenAI Chat Model node named
text
OpenAIjson
{ "workflow_id": "email-classifier", "prompt": "{{$node.OpenAI.json.messages[0].content}}", "output": "{{$node.OpenAI.json.choices[0].message.content}}", "latency_ms": 245, "cost_tokens": {{add($node.OpenAI.json.usage.prompt_tokens, $node.OpenAI.json.usage.completion_tokens)}}, "model": "gpt-4"} Step 5: Test the Node
- Click Test step (play icon) to send a test request
- You should see a Success response with status 200
- Check FlautoPsy dashboard → Traces to confirm the trace arrived
Step 6: Activate the Workflow
- Run your workflow 10+ times to build a baseline
- Traces will be logged to FlautoPsy after each run
- Once mature (≥10 traces), drift alerts will trigger automatically
n8n-Specific Notes
- Use for variable substitution, nottext{{}}or other formatstext${}
- The HTTP Request node automatically sets textContent-Type: application/json
- Test individual nodes by clicking Test step
- If your workflow has multiple branches, place the HTTP Request node after your LLM call
Common Issues
"Request failed: 401 Unauthorized"
- Double-check your webhook URL is correct
- Copy it again from FlautoPsy Settings → Setup
- Ensure no typos in the workspace_id parameter
Variables Not Showing in Output
- The LLM node must run before the HTTP Request node
- Check that your LLM node actually outputs the fields you're trying to access
- Use on the LLM node first to verify output formattextTest step
Latency Not Recorded
- n8n's execution time is available via , but it may varytext$execution.runData
- You can hard-code a value (e.g., ) for testingtext250
- Or calculate it manually: text{{(new Date()).getTime() - $node.YourLLMNode.json.startTime}}
Troubleshooting
Workflow runs but traces don't appear
- Check that all 10 required fields are in the JSON body
- Verify the HTTP Request node shows a 200 OK response
- Check FlautoPsy dashboard → Traces tab (may take 5-10 seconds to appear)
How do I see what was sent?
- Use the Output tab in the HTTP Request node to inspect the response
- Or use n8n's Debug mode to see the full request/response
Next Steps
- View your workflow in FlautoPsy
- Learn about drift detection types
- Read FAQs for more questions