Skip to Content

ColdTrack Bridge Example

ColdTrack is a shipping bridge for temperature-controlled logistics. It demonstrates carrier account integration with real-time tracking.

Manifest

const manifest: BridgeManifest = { name: 'coldtrack-live', displayName: 'ColdTrack Live', description: 'Cold chain shipment tracking and management', version: '1.0.0', category: 'shipping', integrationType: 'api', icon: 'thermometer', authMethods: { apiKey: true, accessToken: false, oauth2: false }, configFields: [ { name: 'apiKey', label: 'API Key', type: 'password', required: true }, { name: 'accountId', label: 'Account ID', type: 'text', required: true }, { name: 'environment', label: 'Environment', type: 'select', required: true, options: [ { label: 'Production', value: 'production' }, { label: 'Sandbox', value: 'sandbox' }, ], }, ], tasks: [ { name: 'grab-shipments', displayName: 'Grab Shipments', description: 'Fetch shipments', category: 'sync', supportsSchedule: true }, { name: 'create-shipment', displayName: 'Create Shipment', description: 'Create a cold chain shipment', category: 'push', supportsSchedule: false }, { name: 'get-rates', displayName: 'Get Rates', description: 'Get cold chain shipping rates', category: 'sync', supportsSchedule: false }, { name: 'get-tracking', displayName: 'Get Tracking', description: 'Get tracking with temperature data', category: 'sync', supportsSchedule: false }, ], };

Environment-Aware Base URL

function getBaseUrl(credentials: Record<string, string>) { return credentials.environment === 'sandbox' ? 'https://sandbox-api.coldtrack.com/v1' : 'https://api.coldtrack.com/v1'; }

Cold Chain Tracking

The ColdTrack bridge extends standard tracking with temperature monitoring:

async function getTracking(context: BridgeTaskContext, input: Record<string, unknown>) { const baseUrl = getBaseUrl(context.config.credentials); const response = await fetch( `${baseUrl}/shipments/${input.trackingNumber}/tracking`, { headers: { 'X-API-Key': context.config.credentials.apiKey } } ); const data = await response.json(); return { success: true, data: { trackingNumber: data.tracking_number, status: data.status, events: data.events.map(e => ({ timestamp: e.timestamp, description: e.description, location: e.location, temperature: e.temperature_celsius, // Cold chain specific temperatureAlert: e.temperature_alert, })), }, }; }

This bridge demonstrates how the standard Bridge SDK can be extended for specialized use cases while maintaining compatibility with the unified data model.