Respond to a confirmed shipment delay¶
Use a carrier status lookup to distinguish a pending status from a confirmed delay. Publish an event when the carrier confirms a delay, then let a subscriber record guidance and notify the operations team.
Before you begin¶
Register an active SHIPMENT_DELAY signal with String fields shipmentId and trackingNumber. Configure an HTTPS carrier status operation, an AI Guidance-enabled shipment Business Object, and an email account with a test recipient.
Workflow flow¶
flowchart TD
subgraph Publisher["Publisher workflow"]
Webhook([Shipment status request]) --> Init["Set Variables · Initialize the check count"]
Init --> Carrier["External REST · Check carrier status"]
Carrier -->|Lookup fails| Error([Handle the lookup error])
Carrier -->|Lookup succeeds| Count["Set Variables · Increment the check count"]
Count --> Status{"Switch · Carrier status"}
Status -->|PENDING| Retry{"If Condition · Fewer than three checks?"}
Retry -->|Yes| Wait["Wait · Retry after two minutes"]
Wait --> Carrier
Retry -->|No| Unconfirmed([Return unconfirmed status])
Status -->|DELAYED| Publish["Publish Signal · SHIPMENT_DELAY"]
Publish --> Confirmed([Return confirmed status and event key])
Status -->|Other| Other([Return the carrier status])
end
subgraph Subscriber["Subscriber workflow"]
Signal([Signal trigger]) --> Guidance["AI Guidance · Record a recommendation"]
Guidance --> Email["Send Email · Notify operations"]
Email --> End([End])
end
Publish -.-> Signal
Configure the workflows¶
Configure the publisher¶
- Start and Comment. In the publisher, define String webhook inputs
shipmentId,trackingNumber, andeventKey. Connect Start to initialization with Set Variables, setting an Integerchecksto0. Add a Comment on the canvas explaining the retry limit and the condition for publishing. - External REST. Add
CHECK_CARRIERand select the carrier status operation. Map the tracking number from{{$context.$triggers.REST.$input.trackingNumber}}. After each successful lookup, incrementcheckswith Set Variables. Route lookup failures to error handling. - Switch. Set Case Expression to
{{$context.$nodes.CHECK_CARRIER.$output.status}}for the sample carrier contract. RoutePENDINGto the retry check,DELAYEDto publication, and other statuses to a Return that reports the carrier status without publishing. - If Condition and Wait. On the
PENDINGpath, use If Condition to evaluate{{$context.$variables.checks < 3}}. On the true path, set Wait time in minutes to2and Loop Back Node toCHECK_CARRIER. On the false path, return a result that indicates the status remains unconfirmed. - Publish Signal. Select the registered signal and version. Map the payload fields from the webhook and Signal Key to
{{$context.$triggers.REST.$input.eventKey}}. Use an event key that identifies this occurrence across retries. Leave Wait for Subscribers off and return the confirmed status and event key after publication succeeds.
Configure the subscriber¶
- AI Guidance. In a separate workflow, subscribe to the signal version and configure the subscription's execution identity. Add an AI Guidance node with Operation set to Write and Reference Type set to Business Object. Select the enabled shipment object and map the signal's
shipmentIdto Record Key using the expression picker. Store a recommendation to confirm a revised delivery estimate with the carrier. - Send Email and End. After the guidance write succeeds, send an email to the test operations mailbox. Include the shipment ID and recommended follow-up. Connect the successful notification path to End.
Run the shipment delay workflow¶
Publish the subscriber before invoking the publisher. Use a test carrier response that returns PENDING on the first check and DELAYED on the second.
Sample publisher request
{
"invocationMode": "END_USER",
"message": "Check the carrier status.",
"parameters": {
"shipmentId": "SHIP-1042",
"trackingNumber": "TRK-8071",
"eventKey": "DELAY-SHIP-1042-01"
}
}
Sample publisher output
The subscriber handles the guidance write and email in a separate run after the signal is published.
Expected behavior¶
| Scenario | Expected behavior |
|---|---|
| First check is pending and second confirms a delay | The publisher waits once and publishes the signal after the second check. |
| Three checks remain pending | The publisher exits without publishing. |
| Carrier returns an error | The error path runs and the workflow does not report a confirmed delay. |
| Subscriber receives a confirmed delay | It writes guidance against the intended shipment and sends the notification to the test mailbox. |
Related guides
External REST · Switch · Wait · Signals · AI Guidance · Send Email