Order Transfer Using the Add Orders API Method

To transfer orders, send a request using the Add orders API method. You can transfer up to 1000 orders in one request.

Every time you send an API order, the system creates an event that can trigger a workflow. You can create different events for different order statuses, which allows setting triggers for each change in the order status.

Events name consist of two parts: the word order and its status, for example, orderINITIALIZED, orderIN_PROGRESS, orderDELIVERED, orderCANCELLED, orderABANDONED_SHOPPING_CART.

To see the created events, go to Automation > Event history.

Each event contains required parameters and can contain optional parameters.

  • ${eventKey}- event unique key transferred in externalOrderId. Used as an order identifier;
  • ${orderId}- event ID in our system. Required to assign the event to a workflow;
  • ${contactId} - contact ID in our platform;
  • ${EmailAddress} - contact’s email address if it’s transferred in the event;
  • ${SMS}- contact’s phone number if it’s transferred in the event.

📘

Important

If there is no email or phone number in the event, the system can't match the contact with the order and can’t send messages to such contacts.

To substitute parameter values in messages, send the fields with event parameters as an array.

  • Required parameters for the order array: externalOrderId, externalCustomerId, totalCost, status, date, email or phone.
  • Required parameters for the items array: externalItemId, name, quantity, cost, url, imageUrl.

You don't need to transfer the items array if you don't use product data in messages or send orders only for RFM analysis.

See the full list of order fields with descriptions.

Request body example:

{

"orders": [{

"externalOrderId": "100500",

"externalCustomerId": "12345",

"totalCost": 1000,

"status": "INITIALIZED",

"date": "2017-03-08T09:30:00+02:00",

"email": "[email protected]",

"phone": "380942583691",

"firstName": "John",

"lastName": "Smith",

"currency": "USD",

"shipping": 10,

"discount": 0,

"deliveryMethod": "express",

"paymentMethod": "cash",

"deliveryAddress": "First str. 1",

"items": [{

"externalItemId": "200600",

"name": "Super Device",

"category": "devices",

"quantity": 1,

"cost": 990,

"url": "http://example.com/item/200600",

"imageUrl": "http://example.com/item/200600/image.png",

"description": "High quality"

}]

}]
}

If the request is successful, the server will return the 200 status code.

📘

Important

Only orders with the DELIVERED status are used to build the RFM table and calculate revenue from campaigns.

You can use orders with the DELIVERED status to build segments with the following conditions: average check, order count, last order date.

Send an ABANDONED_SHOPPING_CART status for abandoned carts. Use it if you track abandoned carts on an external platform. If you use web tracking, you don’t need to send abandoned cart events through API.

To update the status or other order data, send an updated order with the same externalOrderId parameter. It determines the order's uniqueness in the system.

To check whether the order is sent to the system with all the parameters, go to Automation > Orders. Click the order ID to see all the fields in JSON format.

📘

Important

For each unique contact, transfer a unique externalCustomerId parameter with the phone number or email that should be the same in the order and the contact card.

  • If you’ve already sent the order with this externalCustomerId value, the system will automatically assign a new order to the contact with this ID.
  • If the externalCustomerId value is new, the system will match it by phone number or email.