Learn how to reward your users based on our server to server callbacks
In this article, you will learn how to properly set up your callback links. Please note that we can only give rough instructions on how to set up the callbacks on your end, as everybody has different systems for receiving and processing callbacks.
When a user completes a survey or gets a screenout reward, we send a callback. This is how we tell your sercver that one of your users has successfully completed a survey. You can then use the information to reward your users. You can customize the callback link to include all of the parameters you need to reward your users. To achieve this, you'll need to customize your callback URL with the desired parameters.
First of all, make sure you have created your app within the BitLabs dashboard. This requires a verified BitLabs Account, which you can sign up for here if you haven't already. In the top right corner, you'll see a field to configure your postback link. That may be where you found a link to this article ;). In this field, you can start out with a link to the script you need us to call when a user has completed an offer.
To understand callbacks a little bit better, take a look at this final callback link we have sent out:
In order to achieve this callback, here's what we've set up in the BitLabs Dashboard:
As you can see, we have added the needed variables as they are specified below the callback form on your dashboard. It is really important to stick to the right format. Common mistakes are to not include  or to forget about %%. Always use the full variable including [%%] in your callback link on our dashboard. To see if your callback is working, use the callback testing button to send a callback to a specific user with a value of your choice. We are filling out the parameters automatically. Make sure that you are using these variables in your callback, otherwise you cannot edit them in the testing tool.
You can attach all the variables specified in the table on your dashboard. Sometimes you may need additional information with your callback. In this case, you can just add custom variables to the BitLabs link you are sending your users to. We will pass the same parameter back with the callback. Of course, this is optional. Let's say you want to include the fact that your users are doing surveys on an android device in your callback. Within your app, you would attach &source=android to your BitLabs link. This will automatically be added to the callback we send, like this:
Please note that we will not be interpreting your custom variables, meaning what you send in is what is sent back to you.
In order to make callbacks safe, we are we append a "&hash=[HASH] at the end of each callback. This is an important feature for you to make sure that the callback, which you use as a base to reward your users, is coming from BitLabs and is not fake. This hash consists of a HEX encoded SHA1 HMAC. The whole URL is hashed with the secret key of the App. By checking the hash, you can be sure that the postback was actually sent by us and that it is legit.
Callback URL: "https://publisher.com/complete?uid=8cc877ee-af19-488d-b28d-216fb866b996&val=500"
App Secret: "JLOIAUNMHFli7ZJOQVEzm98rzqnm9"
Final Callback sent to the publisher:
These code samples are meant to give you an idea of how to validate hashes. It can also be used as an example of how to handle callbacks in general.