Score cold-chain batch recall risk from IoT excursions with Anthropic and email alerts

Go to Workflow
0 views
Built by Oneclick AI Squad Oneclick AI Squad
Created on July 27, 2026

Description

Quick overview
This workflow receives cold-chain temperature excursion events via webhook, enriches them with shipment route history from a logistics API, uses Anthropic Claude to predict batch compromise risk, then formats and emails a predictive recall alert to quality and operations teams.

How it works
Receives a POST webhook event containing a batch ID, shipment ID, and timestamped temperature/geo sensor readings from cold-chain IoT devices.
Fetches the shipment’s route and handling history from a logistics provider API using the shipment ID.
Calculates risk features such as safe temperature range, excursion count, maximum deviation, minutes outside range, and a route risk score.
Sends the engineered features to Anthropic Claude (claude-sonnet-4) to return a compromise probability, risk level, recommended action, and brief reasoning as JSON.
Parses the model output and builds a formatted predictive recall report, falling back to a rule-based risk assessment if JSON parsing fails.
Emails the report to the configured quality/ops recipients with the batch ID and risk level in the subject line.

Setup
Configure the Webhook trigger URL in your IoT sensor gateway/app to POST excursion payloads to /cold-chain-excursion.
Add your logistics API authentication and replace YOUR_LOGISTICS_API_KEY, and confirm the route-history endpoint matches your provider’s API.
Add an Anthropic API credential for the Claude model used by the workflow.
Add SMTP credentials and set the from/to email addresses for the alert email.

Nodes Used (5)

AI Agent
@n8n/n8n-nodes-langchain.agent
Anthropic Chat Model
@n8n/n8n-nodes-langchain.lmChatAnthropic
Code
n8n-nodes-base.code
HTTP Request
n8n-nodes-base.httpRequest
Send Email
n8n-nodes-base.emailSend