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 .
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 .
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
}
}
}
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:
mutation orderCreate($input: OrderCreateInput!) {
orderCreate(input: $input) {
order {
id
externalId
customer {
id
firstName
lastName
email
phone
}
}
userErrors {
field
message
}
}
}
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:
mutation orderCreate($input: OrderCreateInput!) {
orderCreate(input: $input) {
order {
id
metafields {
key
value
valueType
}
}
userErrors {
field
message
}
}
}
{
"input": {
...
"metafields": [
{
"key": "my_custom_text_field",
"value": "This is a custom text field"
},
{
"key": "my_custom_integer_field",
"value": "6"
}
]
}
}
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:
mutation orderCreate($input: OrderCreateInput!) {
orderCreate(input: $input) {
order {
id
}
userErrors {
field
message
}
}
}
mutation orderCreate($input: OrderCreateInput!) {
orderCreate(input: $input) {
order {
id
shippingAddress {
line1
line1
city
state
postalCode
country
}
}
userErrors {
field
message
}
}
}
That’s it! Your are including order and customer data with your shipments and trackers.
You can read more on .
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 .