Overview
Simulate the full consignment lifecycle on the TWIN staging environment using the provided bash scripts.
The sandbox scripts let each TWIN user simulate their part of the consignment lifecycle against the TWIN staging environment. No TypeScript or Node.js required — only bash and curl. The scripts bring their own jq, nothing to install for that one.
Prerequisites
bashandcurl— usually already installed on macOS and Linux; on Windows, install Git for Windows for both- The scripts themselves — download them from Get the scripts
- Your credentials, provided by the TWIN team — they go in the bundle's
config.env
How it works
The Freight Forwarder publishes a complete consignment lifecycle — 23 activities sent one every 2 minutes: the consignment itself, its documents, and the journey events marking its progress. As each is published, TWIN automatically routes the corresponding notifications:
| Activity | Who gets notified |
|---|---|
| Create / Update (Pre-Notification) | Border Agency — ISN signal |
| Despatch | Border Agency — ISN despatch signal |
Event twin:carrierBooking | Location Operator — MCP notification |
The Location Operator is notified on the carrier booking, and only for consignments calling at a port it manages. That notification carries the consignment globalId, which it uses to read the consignment and then send its match back to TWIN, confirming the consignment matches its records.
The Border Agency receives ISN signals automatically at their configured endpoint. The signal contains the consignment globalId, which can be used to retrieve the full consignment data and download the attached documents.
Being notified and being able to read are separate things: notifications are routed by TWIN, while reading a consignment someone else published depends on that organisation having shared it with you, which is set up in the TWIN web app.
Role tutorials
- Freight Forwarder — publish the consignment lifecycle
- Location Operator — read the consignment and send the match back
- Border Agency — verify ISN signals and read the consignment
Scripts
| Role | Script | Description |
|---|---|---|
| Freight Forwarder | publish-consignment.sh | Publishes the full lifecycle (23 activities) |
| Location Operator | fetch-consignment.sh | Reads the consignment and downloads its documents |
| Location Operator | send-match.sh | Sends the match back for a published consignment |
| Border Agency | fetch-consignment.sh | Reads the consignment and downloads its documents |