The 'fulfilment_pending' webhook is fired when rewards are prepared for fulfilment. Non-monetary rewards like credits, free months, etc, rewards enter in fulfilment as soon as they are approved.
In case you have the "Auto-approve rewards" checked for the campaign, the webhook will be fired right after the reward is attributed.
How to respond to this webhook call
respond with status 200 - we consider that you fulfilled the reward(like added the free subscription months or free credits) on your end and we will mark the fulfilment as "completed" on our end.
respond with status 2xx(except 200) - we will keep the fulfilment marked as pending on our end, nothing will actually happen.
respond with any other status - we consider as an error and will keep retrying for 7 times during the day
The most important data sent with the webhook event payload:
Event
This object contains information about the event webhook. The most important fields are:
id - eq. "5367" - webhook event id
type - eq. "fulfilment_pending" - webhook event type. All webhooks contain the event.type field, you need to use this field in a condition to determine the actions needed to take for this kind of webhook.
created_at - eq. "2017-10-13T15:46:01.606Z" - date and time when the event occurred.
Data
This object contains the data of the object who determined the event.
id - eq. "90" - fulfilment object id
status - eq. "pending" - current state of the fulfilment. Most likely it will be "pending" in this case.
date_paid - "null" in this case since the fulfilment is pending
amount - eq. "20" - amount of the reward fulfilled. If the reward is "20 credits", here you will see "20".
unit - eq. "credits" or "free_months" or "cash" - the reward unit. For "20 credits", here you will see "credits"
campaign - JSON containing campaign information
promoter - JSON containing information about the promoter who referred the lead.
Promoter JSON :
id - eq. "234" - id of the promoter
cust_id - eq "23452" - an ID to help you identify the promoter in you system in case he/she is a customer/user.
auth_token - eq "da954kn43856nacueroytnjrwg46k5" - authentication token
earnings_balance - eq. "{'cash' : 20000}" or "{'free_month' : 2} or "{'credits' : 20}- JSON containing the total amount of rewards promoter earned
current_balance - JSON containing remaining amounts after payments/fulfillments
paid_balance - JSON containing paid/fulfilled amounts
email - promoter email
temp_password - eq. "dsf23fd3" - temporary password generated - can be used for login only if the promoter sign up page doesn't include the password field and promoter hasn't set his own password
profile - eq. "{'first_name':'John', 'website':'mywebsite.com'}" - JSON containing information about the promoter including name, website, social accounts, etc
To add a webhook in FirstPromoter, you will need to access Campaigns - Edit Campaign - Finish - Show extra options (campaign level-up and webhooks) - Webhook URLs - Add the desired webhook URL and test it by clicking on "Test webhook" - Save.