Feed order, customer & product data

Overview

This guide walks you through how to include additional data to your shipments and trackers. These extra order and customer data will greatly improve your experience inside the platform as well as allow you to send proactive notifications to your customers.

Get our GraphQL Playground running

To follow along the the steps in this guide we'll provide an interactive environment for Ruby, Python and Node. You can also use GraphQL directly with our GraphQL Playground.

Creating a customer

Customers represent your users in Kublau’s API and allow you to send proactive notifications. It also serves as valuable reference information for a tracker or shipment.

In order to connect a customer with a Tracker or Shipment you'll need to create an Order.

Here is an example of how to create a customer:

mutation customerCreate($input: CustomerCreateInput!) {
  customerCreate(input: $input) {
    customer {
      id
      firstName
      lastName
      phone
      email
      taxId {
        value
        type
      }
    }
    userErrors {
      field
      message
    }
  }
}

Creating an order

An order connects a Tracker or Shipment with the customer they belong to. It also allows you to store additional information such as a unique identifier, tags (coming soon) or custom attributes (coming soon).

Here is an example of how to create an order:

Passing custom data to the Order with metafields

Metafields enable you to save specialized information that isn't usually captured by standard Kublau resources. You can use Metafields for internal tracking, custom flows inside Kublau or to display specialized information on your emails and tracking pages in a variety of ways.

Here is an example of how to include a text my_custom_text_field field and an integer my_custom_integer_field integer field when creating an order:

You can read more on how to add your own custom metafields here.

Adding product information to the order

Products define what you are shipping in Kublau’s API and allow you to improve and customize notifications. It also serves as valuable reference information for a tracker or shipment.

Here is an example of how to specify which product you are shipping while creating an order:

Adding address information to the order

An order has ashippingAddress field which represents the address this order is being shipped to. If you generate the label with our API we will automatically use the destination address of your shipment when referencing an order when creating a tracker.

Referencing the order on a Tracker or Shipment

When creating a Tracker (trackerCreate) or Shipment (shipmentCreate) include the orderId argument with the id of the order you created.

Here is an example of GraphQL Query Variables that include an orderId :

That’s it! Your are including order and customer data with your shipments and trackers.

Last updated

Was this helpful?