OkCollect Webhook

This webhook allows log user interactions with their OkHi address enabling you to get rich data insights from OkHi.

Create an address interaction

POST https://sandbox-server.okhi.dev/v5/interactions

Headers

Request Body

{
    "success": true
}

If you don't supply a locationId then the user & location parameters are required

Properties Object

A dictionary of information that provides useful details to a given address interaction relevant to your business.

All fields except the ones listed in the table below are open to you to design to suit your business.

Here's an example of a properties JSON object that you could have in a checkout context:

Properties Object
{
  "brand": "acme",
  "branch": "thehub",
  "paymentMethod": "cash",
  "currency": "KES",
  "sendToQueue": true,
  "basket": [
    {
      "sku": "RF67DESL1/XFA",
      "value": 180000.00,
      "name": "RF67DESL FDR with Twin Cooling Plus, 491 L",
      "description": "Refrigerator is designed to improve the way you store food through an innovative 2-Door system.",
  	  "category" : "fridge",
      "quantity": 1
    },
    {
      "sku": "MG28J5255GS/SM",
      "value": 5500.00,
      "name": "MW5200J Grill Microwave Oven with Healthy Steam, 28 L",
      "description": "Enjoy the flexibility to bake and microwave – all from one appliance",
      "category": "microwave ovens",
      "quantity": 1,
      "weight": 1.2
    }
  ],
  "shipping": {
    "cost": 120.00,
    "class": "Flat rate",
    "expectedDeliveryDate": "2019-08-12T09:42:22.526Z"
  }
}

User Object

This is only required if you don't have an OkHi location ID

OkHi User object
{
    "firstName": "Bob",
    "lastName": "Mark",
    "phone": "+254712345678"
}

Location Object

This is only required if you do not have an OkHi location Id.

You must supply at least one of these fields: a street name, property name, directions, placeId(from OkHi), lat & lng

An example of an OkHi location JSON object, only required if you don't have a location ID

OkHi Location Object
{
        "lat": -1.2489607,
        "lng": 36.7521819,
        "placeId": "LKjs8YA7",
        "streetName": "Loresho Close",
        "propertyName": "Park Villas"
}

Full example payload for an ecommerce transaction:

{
    "id": "{{uniqueTransactionId}}",
    "useCase": "e-commerce",
    "locationId": "WtyVrLr3yn",
    "value": 185500,
    "user": {
        "firstName": "E",
        "lastName": "M",
        "phone": "+254712345678"
    },
    "properties": {
        "brand": "acme",
        "branch": "thehub",
        "paymentMethod": "cash",
        "sendToQueue": true,
        "basket": [
            {
                "sku": "RF67DESL1/XFA",
                "value": 180000,
                "name": "RF67DESL FDR with Twin Cooling Plus, 491 L",
                "description": "Refrigerator is designed to improve the way you store food through an innovative 2-Door system.",
                "category": "fridge",
                "quantity": 1
            },
            {
                "sku": "MG28J5255GS/SM",
                "value": 5500,
                "name": "MW5200J Grill Microwave Oven with Healthy Steam, 28 L",
                "description": "Enjoy the flexibility to bake and microwave – all from one appliance",
                "category": "microwave ovens",
                "quantity": 1,
                "weight": "1 kg"
            }
        ],
        "shipping": {
            "cost": 120,
            "class": "Flat rate",
            "expectedDeliveryDate": "2019-08-12T09:42:22.526Z"
        }
    }
}

IMPORTANT: For production please switch this endpoint to https://server.okhi.co/v5/interactions

Last updated