This webhook allows log user interactions with their OkHi address enabling you to get rich data insights from OkHi.
Create an address interaction
POSThttps://sandbox-api.okhi.io/v5/interactions
Headers
Request Body
{"success": true}
{"code": 400,"message": "Specify either a location ID or a location object"}
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","payment_method": "cash","currency": "KES","send_to_queue": 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
Full example payload for an ecommerce transaction:
{"id": "{{uniqueTransactionId}}","use_case": "e-commerce","location_id": "WtyVrLr3yn","value": 185500,"user": {"first_name":"E","last_name":"M","phone":"+254712345678" },"properties": {"brand":"acme","branch":"thehub","payment_method":"cash","send_to_queue":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","expected_delivery_date":"2019-08-12T09:42:22.526Z" } }}
IMPORTANT: For production please switch this endpoint to https://api.okhi.io/v5/interactions
Authenticate to the OkHi API by sending your branch ID and server key along with a request. Authentication is by passing a header value of base64 encoding of branchId:serverKey prepended with the string "Token " to the Authorization property.
In practice that means taking your branch ID, eg if your branch id is abc adding a colon, and then appending your server key to it, eg, if your server key is xyz. After base64 encoding abc:xyz becomes YWJjOnh5eg==; and this is passed in the authorization header like so: Authorization: Token YWJjOnh5eg==.
user
string
OkHi user object, see example below
value
number
eg. for a checkout this could be the order amount
id
string
A unique order ID
use_case*
string
for loans this could be "loan". For e-commerce this could be: "e-commerce"
location_id
string
OkHi location ID
location
object
OkHi location object would be required if you don't have a location ID. See example below
properties
object
This is an open field where you can put any business related information related to the interaction for use in analysis later. See an example below.
Field
Type
Description
send_to_queue
boolean
Mostly used in e-commerce. Set to true in order to push the checkout details to OkHi Queue app for dispatch management