| Event | Sent when |
|---|---|
| shipment_documents/create | A file is attached to one of your shipments |
| shipment_documents/update | The name, the file class or the visibility of a document on one of your shipments changes |
data holds one document. parent_type is always Logistics::Loading, and parent_id is the numeric id of the shipment, the same value as transaction_id in the shipments API. auth_code says who can see the document in Modaltrans: 1 is Everybody, the customer portal included, and 0 is Our Team Only, your own users. Every key is always sent. A missing value comes as null, except parent_customer_ref, which comes as an empty string when the shipment has no customer reference.eventKey in the envelope identifies the document. It is the same on its create and on every update that follows, so upsert on it. deliveryId is unique per delivery and only repeats on a retry or a resend of that same delivery, so de-duplicate on it. These events have no eventID and no modaltrans object.update can arrive for a document you have no record of yet, for example one attached before the endpoint was created. Treat it as a create.parent_type and parent_id from the payload:document_url. Pick the one whose id matches data[0].id and download the file from its document_url. The link is signed and short-lived, so ask for the list right before you download rather than storing the URL. A test delivery, the one with test set to true, carries made-up ids that match no real document, so skip the download for it.