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.

Create a webhook

To create a webhook:

Update/delete a webhook

To update or delete a webhook hover over the three dots to the right of the webhook to open the settings menu and click on the link to update or delete.

Test a webhook

To test a webhook hover over the three dots to the right of the webhook to open the settings menu and click on "Send test webhook"

Authentication token

SparkLoop authenticates all webhooks with a token in the SparkLoop-Token request header. This allows you to verify that the events were sent by SparkLoop, not by a third party.

While this is entirely optional, it adds an extra layer of security: simply check the token in the SparkLoop-Token header is the same as your authentication token. If not, ignore the webhook!

You can find your authentication token in your Webhooks page.

Events

We currently send three types of events:

new_referral

Is sent when a new referral made by a subscriber in a referral program is tracked

{
  "type": "new_referral",
  "campaign_id": "MF6319db9890",
  "subscriber": {
    "id": "sub_hjdgc74u",
    "first_name": "John",
    "name": "John Doe",
    "email": "john.doe@email.com",
    "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": "john.smith@email.com",
    "referral_code": "f9464199",
    "referral_link": "https://mywebsite.com?rh_ref=f9464199",
    "referred": false,
    "tot_referrals": 4,
    "next_reward": 1,
    "created_at": 1564403873
  }
}

new_partner_pending_referral

Is sent when a referral made by a partner is starts the screening period

{
  "type": "new_partner_pending_referral",
  "campaign": {
    "id": "partner_campaign_de9c1c7c7bbc",
    "referral_code": "1b5b5c4094",
    "type": "partner_program",
    "upscribe": true,
    "partner_program_id": "partner_program_5b925f623c28"
    "publication_id": "pub_a6db3f666c55",
    "created_at": 1658780774
  },
  "subscriber": {
    "id": "sub_042448acb02a",
    "first_name": null,
    "name": null,
    "email": "test12345@test.com",
    "referral_code": "6363a0b5",
    "referred": true,
    "tot_referrals": 0,
    "referral_status": "pending",
    "last_reward": null,
    "partner_id": "partner_0a8a45c403f8",
    "created_at": 1659536359
  },
  "partner": {
    "id": "partner_0a8a45c403f8",
    "name": "Jason Resnickss",
    "logo": "http://dash.sparkloop.app/rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBPQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--36ac8d234a450db1db32c62fe9e399b29a9e42f0/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9VY21WemFYcGxYM1J2WDJ4cGJXbDBXd2RwQVpacEFaWT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--b97dd663f95aeeb4752185ef091f0728b0f28f4a/active_campaign.png"
  }
}

new_partner_referral

Is sent when a referral made by a partner is confirmed

{
  "type": "new_partner_referral",
  "campaign": {
    "id": "partner_campaign_de9c1c7c7bbc",
    "referral_code": "1b5b5c4094",
    "type": "partner_program",
    "upscribe": true,
    "partner_program_id": "partner_program_5b925f623c28"
    "publication_id": "pub_a6db3f666c55",
    "created_at": 1658780774
  },
  "subscriber": {
    "id": "sub_042448acb02a",
    "first_name": null,
    "name": null,
    "email": "test12345@test.com",
    "referral_code": "6363a0b5",
    "referred": true,
    "tot_referrals": 0,
    "referral_status": "verified",
    "last_reward": null,
    "partner_id": "partner_0a8a45c403f8",
    "created_at": 1659536359
  },
  "partner": {
    "id": "partner_0a8a45c403f8",
    "name": "Jason Resnickss",
    "logo": "http://dash.sparkloop.app/rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBPQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--36ac8d234a450db1db32c62fe9e399b29a9e42f0/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9VY21WemFYcGxYM1J2WDJ4cGJXbDBXd2RwQVpacEFaWT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--b97dd663f95aeeb4752185ef091f0728b0f28f4a/active_campaign.png"
  }
}

reward_unlocked

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

{
  "type": "reward_unlocked",
  "campaign_id": "MF6319db9890",
  "referrals": 4,
  "coupon_code": "9wusha0",
  "subscriber": {
    "id": "sub_hjdgc74u",
    "first_name": "John",
    "name": "John Doe ",
    "email": "john.doe@email.com",
    "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
  }
}

reward_redeemed

Is sent when a subscriber redeems a reward by submitting their address details.

{
  "type": "reward_redeemed",
  "campaign_id": "MF6319db9890",
  "referrals": 4,
  "coupon_code": "9wusha0",
  "subscriber": {
    "id": "sub_hjdgc74u",
    "first_name": "John",
    "name": "John Doe ",
    "email": "john.doe@email.com",
    "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
  },
  "reward_variant_name": "T-Shirt XXL",
  "reward_variant_sku": "t_shirt_xxl",
  "shipping_details": {
    "shipping_name": "John Doe",
    "shipping_phone": "+01 407-889-2040",
    "shipping_address_1": "7838 Pearl Drive",
    "shipping_address_2": null,
    "shipping_city": "Sun City",
    "shipping_state_code": "AZ",
    "shipping_zipcode": "85351",
    "shipping_country_code": "US"
  }
}

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.

Last updated