How to set up events API?

The events API is used to feed the events from your application to Engagespot account. The user hash is passed along with the events. So we can send notifications based on the user behavior. You can design custom automation rules from the journey designer.

events API

    • Usage: To feed the events from the client app to the Engagespot account.
    • URL:
    • Method: POST
    • Inputs :
      • Headers :
        • API-Key - your API key (found in website settings page)
        • Content-Type - value set to 'application/json'
      • Body :
        • user_hash - the unique identifier generated by Engagespot to identify the users.
        • action - the action performed by the user.
Eg: search, purchase, added_to_cart etc.
        • object - the additional information of action performed.
action : purchased,{ "category" : "entertainment", "product" : "ps3", "price($)" : 300}
You can access the user hashes from the cookie with the key '_webPushUserHash'.
      • Output: status and message

Here is the PHP CURL example for the sample events API call,

<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "", CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "{\n\t\"user_hash\" : \"xxxxxxxxxxxxxxxxxxxx\",\n\t\"action\" : \"purchased\",\n\t\"object\" : {\n\t\t\"category\" : \"entertainment\",\n\t\t\"product\" : \"ps3\",\n\t\t\"price($)\" : \"300\"\n\t}\n}", CURLOPT_HTTPHEADER => array( "api-key: xxxxxxxxxxxxxxxxxxxx", "content-type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }?>

Did this help answer your question?

thumbs up
thumbs down

Thanks for the feedback! 🙏🏽

Help by drift