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.

Event Names

Event names 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.

Event history

Event Parameters

Each event contains required parameters and can include 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.

The contact ID must be one of the following:

  • ${externalCustomerId} - external contact ID;
  • ${email} - contact’s email address;
  • ${phone}- contact’s phone number if it’s transferred in the event.

📘

Important

If there is no external customer ID, 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. In such cases, you can see contact ID in the Automation > Orders tab > Contact data column

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

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

📘

Note

The price of the products transferred in an order must match the totalCost value (total order amount). If a customer buys an item with a discount, it should be placed in the items.cost field for each product.

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 on the Report tab.

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

Segment creation

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.

Checking Event Parameters

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. Also you can see information about the contact by clicking Contact preview icon.

📘

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.

Creating Workflows

  1. Go to Automation → Workflows and click New workflow.
New workflow
  1. Specify the workflow name (e.g., Order delivered, Order in progress, etc.)
  2. Add the following blocks to the workflow:
    • The Task block → the Get order task name. The block will pull out all the order data and send it to the email.
    • A message-sending block. Select the message that you previously created for this workflow (order notification, NPS, etc.)
Workflow example

Instead of one message, you can make a series. For example, 1-2 weeks after notification of the delivered order, send a request to leave a review.

Learn more about setting workflow start and stop conditions >