What are Triggers?


Triggers are an effective way to notify your internal systems when certain events take place and can include shipment shipped, shipment updated, order cancelled and order errored. The list can be customised and new triggers added where required. These can be configured to be sent off for all orders, going to all PSPs. 


Events: These are a set of events that are created by default and are as follows:


Order Received
The order has been accepted by the system but the artwork has not yet been retrieved.
Order Printready
The artwork has been successfully retrieved and the order is now ready to enter production.
Order Errored
The artwork is not available, due to either a pre-flight failure or an invalid fetch URL. An order will go to error 12 hours after order submission.
Order Cancelled
The order has been cancelled by the brand or the end consumer.
Component Printed
An item component has been successfully printed.
Shipment Shipped
A shipment has been shipped.


Type: The format of the trigger, which can be a HTTP postback or email.


HTTP (POST, PUT, GET) - Post to a HTTP endpoint. This must be an open URL which cannot contain login credentials, however a static token can be included either in the header or the body of the payload to be validated upon entry into the system.


Method: Choose whether you want to use a POST, PUT or GET request


Save postback to order: Setting this to YES ensures that the postback will be recorded on the postbacks tab within the order


Request headers: The following variables can be used in the headers:


content-type
application/json
content-type
text/xml
content-type
text/plain
content-type
text/html
authorization
code provided by brand to be inserted into the header and allows the receiver to validate that the message is coming from a trusted source


Template: Here you can select whether to use one of your previously created templates (this is the recommended setup).


Sample Trigger Templates


The following templates can be copied into your account and assigned to the trigger. If you require triggers to be sent in a format other than JSON or wishes for custom fields to be included please gather these requirements and send to OneFlow. OneFLow will evaluate the required and if possible, provide a quote to develop the template.


Order Received
{
  "TimeStamp":"{{timestamp}}",
  "SourceOrderId":"{{data.orderData.sourceOrderId}}",
  "OrderStatus":"received"
}
Order Printready
{
  "TimeStamp":"{{timestamp}}",
  "SourceOrderId":"{{data.orderData.sourceOrderId}}",
  "OrderStatus":"printready"
}
Order Errored
{
  "TimeStamp":"{{timestamp}}",
  "SourceOrderId":"{{data.orderData.sourceOrderId}}",
  "OrderStatus":"error"
}
Order Cancelled
{
  "TimeStamp":"{{timestamp}}",
  "SourceOrderId":"{{data.orderData.sourceOrderId}}",
  "OrderStatus":"cancelled"
}
Component Printed
{
  "TimeStamp":"{{timestamp}}",
  "SourceOrderId":"{{data.sourceOrderId}}",
  "PrintedComponentId":"{{data.sourceItemId}}",
  "OrderStatus":"componentprinted"
}
Shipment Shipped
{
  "TimeStamp":"{{timestamp}}",
  "SourceOrderId":"{{data.sourceOrderId}}",
  "SourceShipmentId":"{{data.sourceShipmentId}}",
  "ShipmentIndex":"{{data.shipmentIndex}}",
  "TrackingNumber":"{{data.trackingNumber}}",
  "OrderStatus":"received"
}


Common Questions


  • Triggers will time out if a response is not received within 5 seconds, can this be changed? No
  • Can a postback contain a specific message as to why an order went to error? No, only a static error message can be recorded, however, an order will only go to error if the artwork fails pre-flight or if it cannot be retrieved from the supplied URL.
  • Can a postback be manually generated for testing purposes? Not currently, only the even taking place can trigger a postback. The print shop and print buyer should liaise to organise for the system to be tested end-to-end to ensure that all triggers are sent and the expected information is received.
  • How can I test the cancelled order trigger? You can either manually cancel the order from within the UI, or alternatively via the API using the cancel order call.
  • Can you provide the fixed IP address to be whitelisted by our system to allow for postbacks to be accepted and the artwork downloaded? No, this is not possible as the system runs on AWS, which has a large range of potential IP addresses that cycle multiple times per week.
  • How do I determine whether the postback was sent and if it was successful? You can check this information by looking at the postbacks tab within an order. If a postback it shown, it has been sent and you will also see the returned message.
    • Success: 200 - The endpoint has acknowledged the receipt of the postback.
    • Fail 400: Error - Bad request. The payload contains information not recognised by the receiving system.
    • Fail 415: Error - Unsupported media type. This means that the 'header' configured on the trigger is incorrect.
    • Fail 500: Error - Internal server error.
    • Fail 999: Error - timeout of 5000ms exceeded. The endpoint did not respond in the allowed timeframe.
  • Can I report on each item within an order created or shipment shipped postback? Yes, you can use the following function to break the postback into items. The only difference will be the second line. One order creation this is {{#each data.orderData.items{}} and on shipment shipped it is 


                {{# each data.items}


                    “items”: [
                      {{#each data orderData.items}}
                      {
                               “sourceItemId”: “{{sourceItemId}}”,
                               “sku”: “{{sku}}”,
                               “quantity”: “{{quantity}}
                     {{#if @last}}
                     }
                    {{else}}
                    },
                    {{/if}}
                    {{/each}}
                     ]
                      }