TWIN Supply Chain Docs
TutorialsSandbox scripts

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

  • bash and curl — 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:

ActivityWho gets notified
Create / Update (Pre-Notification)Border Agency — ISN signal
DespatchBorder Agency — ISN despatch signal
Event twin:carrierBookingLocation 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

Scripts

RoleScriptDescription
Freight Forwarderpublish-consignment.shPublishes the full lifecycle (23 activities)
Location Operatorfetch-consignment.shReads the consignment and downloads its documents
Location Operatorsend-match.shSends the match back for a published consignment
Border Agencyfetch-consignment.shReads the consignment and downloads its documents

On this page