Skip to content

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

  1. Start and Comment. In the publisher, define String webhook inputs shipmentId, trackingNumber, and eventKey. Connect Start to initialization with Set Variables, setting an Integer checks to 0. Add a Comment on the canvas explaining the retry limit and the condition for publishing.
  2. External REST. Add CHECK_CARRIER and select the carrier status operation. Map the tracking number from {{$context.$triggers.REST.$input.trackingNumber}}. After each successful lookup, increment checks with Set Variables. Route lookup failures to error handling.
  3. Switch. Set Case Expression to {{$context.$nodes.CHECK_CARRIER.$output.status}} for the sample carrier contract. Route PENDING to the retry check, DELAYED to publication, and other statuses to a Return that reports the carrier status without publishing.
  4. If Condition and Wait. On the PENDING path, use If Condition to evaluate {{$context.$variables.checks < 3}}. On the true path, set Wait time in minutes to 2 and Loop Back Node to CHECK_CARRIER. On the false path, return a result that indicates the status remains unconfirmed.
  5. 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

  1. 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 shipmentId to Record Key using the expression picker. Store a recommendation to confirm a revised delivery estimate with the carrier.
  2. 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

{
  "shipmentId": "SHIP-1042",
  "status": "DELAYED",
  "eventKey": "DELAY-SHIP-1042-01"
}

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