Webhooks

Webhooks are used to send events from SparkLoop to your server. We send a POST HTTP request with a JSON payload when specific events occur.

To enable webhooks:

  • go to your campaign dashboard > Settings > Webhooks

  • enter the URL of your webhook in the Webhook section

  • After you save you can click on the button Send test notification to test your integration.

We currently send two types of events:

new_referral

Is sent when a new referral is tracked

{
"type": "new_referral",
"campaign_id": "MF6319db9890",
"subscriber": {
"id": "sub_hjdgc74u",
"first_name": "John",
"name": "John Doe",
"email": "[email protected]",
"referral_code": "ada90f39",
"referral_link": "https://mywebsite.com?rh_ref=ada90f39",
"referred": true,
"tot_referrals": 0,
"next_reward": 2,
"created_at": 1564400550
},
"referrer": {
"id": "sub_93ehus8h",
"first_name": "John",
"name": "John Smith",
"email": "[email protected]",
"referral_code": "f9464199",
"referral_link": "https://mywebsite.com?rh_ref=f9464199",
"referred": false,
"tot_referrals": 4,
"next_reward": 1,
"created_at": 1564403873
}
}

reward_unlocked

Is sent when a subscriber hits a milestone and unlocks a reward

{
"type": "reward_unlocked",
"campaign_id": "MF6319db9890",
"subscriber": {
"id": "sub_hjdgc74u",
"first_name": "John",
"name": "John Doe ",
"email": "[email protected]",
"referral_code": "f9464199",
"referral_link": "https://mywebsite.com?rh_ref=f9464199",
"referred": true,
"tot_referrals": 4,
"next_reward": 2,
"created_at": 1564403873
},
"reward": {
"id": "reward_cdebf4f013",
"name": "2018 Private Report: State of the Ecommerce",
"referrals": 4,
recurring: false
}
}

Errors

Please send back a blank response with a status code of 200. All not-200 responses will be considered errors. If a webhook fails, we will try to deliver it 3 times over a period of 5 minutes.