Rewarding Votes
How to setup Diffcord webhooks to receive and reward user votes.
Last updated
How to setup Diffcord webhooks to receive and reward user votes.
Last updated
Click on your bot page
Click on dashboard
Visit the API section
At the bottom of the page, there will be a webhook section.
Enter your own endpoint URL, in which our POST requests will be made to. (This must be a publicly available endpoint listening for POST requests that Diffcord will make, if your language is supported by one of our libraries, we suggest you use a library since this is handled for you)
Enter an authorization/verification code. This can be whatever you would like and will be sent along with all our POST requests. This can be used by you to ensure that the requests are indeed coming us.
Remember to "SAVE WEBHOOK CHANGES" once you are complete!
You should now be all ready to receive votes!
Once you are able to receive votes, you must now handle them.
Each request we will make to the URL you provided to us will be a POST request.
We will send the verification code as a header under the Authorization key.
The body of the requests we send will contain a user vote.
With the request data we have provided, you are able to internally reward the user via the user_id field in the body.
Finally, once you have rewarded your users you must acknowledge that you have rewarded them. To do this you must respond to the POST request with a 200 Status Code response, which confirms you have rewarded the vote.
We suggest you use the Webhook Authorization Code, which can verify our requests.
If you would like to strengthen security, or are running into firewall issues, you can whitelist the following IP address range which will be used to send requests to your applications.