Resource
POST https://api.robinhq.com/dynamic/customers/
Success message: 201 Created
Error in JSON: 400 Bad Request
Wrong authentication: 401 Invalid authorisation data
POST
The “Customer Lifetime” endpoint shows the total amount of orders and the total amount of revenue per customer.
What is essential to know:
1. Customers POST works in combination with Endpoint 5 “Customer Lifetime”
The reason for this is because the endpoint only gets requested once a new conversation has opened, thus it will not be updated until the customer has opened a new conversation. For this, we have created the Customers POST to ensure that the data is up-to-date.
The Customers POST
You need to POST Customers when:
Situation 1: When a new order has been placed
Situation 2: When an order has been (partially) refunded
Situation 1: When a new order has been placed
Original Customer Lifetime from customer “email@address.com” was 11 orders and a total revenue of € 100,-
{
"customers":[
{
"email_address":"email@address.com",
"customer_since":"2017-01-29T12:34:56Z",
"order_count":11,
"total_revenue":100.00,
"currency":"€",
"last_order_date":"2017-04-05T12:34:56Z"
}
]
}
The customer “email@address.com” has placed an order, the customer now has 12 orders and a total revenue of 120,00-
{
"customers": [
{
"email_address": "email@address.com",
"customer_since": "2017-01-29T12:34:56Z",
"order_count": 12,
"total_revenue": 120.00,
"currency": "€",
"last_order_date": "2017-04-05T12:34:56Z"
}
]
}
Situation 2: When an order has been (partially) refunded
Original Customer Lifetime from customer “customer@address.com” was 15 orders and a total revenue of € 200,-
{
"customers":[
{
"email_address":"customer@address.com",
"customer_since":"2017-01-29T12:34:56Z",
"order_count":15,
"total_revenue":200.00,
"currency":"€",
"last_order_date":"2017-04-05T12:34:56Z"
}
]
}
The customer has refunded his order, the customer now has 14 orders and a total revenue of 190,-
{
"customers":[
{
"email_address":"customer@address.com",
"customer_since":"2017-01-29T12:34:56Z",
"order_count":14,
"total_revenue":190.00,
"currency":"€",
"last_order_date":"2017-04-05T12:34:56Z"
}
]
}
After you’ve made Endpoint 5 and Customer POST you are done with the Customer Lifetime!
Customers POST Schema
Key | Type | Required | Description | Example |
---|---|---|---|---|
email_address | String | Yes | Email address of your customer | "email@address.com" |
customer_since | String | Yes | when did your customer become a client | "2017-01-29T12:34:56Z" |
order_count | Integer | Yes | Number of orders of your customer | 12 |
total_revenue | Float | Yes | How much did your customer spend | 123.45 |
currency | String | Yes | Currency for this customer. Use '€' or '$' | "$" |
last_order_date | String | Yes | The date of the last order of the customer used to determine the segment of the customer. | "2018-04-05T12:34:56Z" |