What are webhooks?

The webhooks section can be found in the For developer tab of an individual offer.

For developer tab in Monetizr console: https://app.themonetizr.com/offer-manager/my-offers/OFFERIDFor developer tab in Monetizr console: https://app.themonetizr.com/offer-manager/my-offers/OFFERID

For developer tab in Monetizr console: https://app.themonetizr.com/offer-manager/my-offers/OFFERID

Webhooks enables listening for events on your Monetizr account so your integration can automatically trigger reactions.

Monetizr uses webhooks to notify your application/server when a claiming event happens in your account. Webhooks are particularly useful for asynchronous events like when a player claims reward and we confirm that this customers is allowed to receive it from your game. Keep in mind that Monetizr sends POST request with data to your specified endpoint and uses the the authorization headers specified, if there are any.

Begin using webhooks with your integration in just three steps:

  • Create a webhook endpoint on your server.
  • Use the console to test that your endpoint works.
  • Register the endpoint with Monetizr to go live.

Not all integrations require webhooks. Keep reading to learn more about what webhooks are and when you should use them.

Webhooks refers to a combination of elements that collectively create a notification and reaction system within a larger integration.

Webhooks are like a phone number that Monetizr calls to notify you of an activity in your console account. The activity is the creation of a new reward claim process. The webhook endpoint is the server answering that call who takes actions based upon the specific information it receives.

The webhook endpoint is just more code on your server, which could be written in Ruby, PHP, Node.js, or any programming language of your choice. The webhook endpoint has an associated URL (e.g., https://example.com/webhooks). The Monetizr request contain object. This object includes the relevant information about what happened, including the data associated with that event. The webhook endpoint uses the event details to take required actions, Monetizr has to verify that the claiming process is valid and indicate that an order from your game should be fulfilled.

When to use a webhook

Events that occur within a Monetizr account have synchronous results–immediate and direct–to an executed request. Other events that occur within a Monetizr account are asynchronous: happening at a later time and not directly in response to your code’s execution.

For offers claiming process Monetizr utilizes webhooks in results–immediate synchronous event. When a player clicks on rewards claim button in your game, the offer claiming process is initiated by SDK or by API integration. To limit players claiming multiple rewards, Monetizr needs to confirm that a specific player actually is enabled to receive reward. As a first validation Monetizr send a request to your servers. This validation step enables Monetizr to continue offer fulfillment.

How to add and test webhook

As previously, navigate to https://app.themonetizr.com/offer-manager/my-offers/YOUR_OFFER_ID_HERE and head to the For developer tab.

For developer tab in Monetizr console: https://app.themonetizr.com/offer-manager/my-offers/YOUR_OFFER_IDFor developer tab in Monetizr console: https://app.themonetizr.com/offer-manager/my-offers/YOUR_OFFER_ID

For developer tab in Monetizr console: https://app.themonetizr.com/offer-manager/my-offers/YOUR_OFFER_ID

The webhook details include:

  • Endpoint receiving event from your account: the web address the Monetizr send data upon claim request, for example home address https://127.0.0.1
  • Authentication header name: if your endpoint includes authentication, you ca specify additional authentication header data
  • Authentication header value: if your endpoint includes authentication header, then you should specify header value in this field

After clicking on "Save" your webhook will be created and available for all of your claimable offers. Then you can test the webhook from console and send payload similar to the real claiming request.

Sending a test webhook requestSending a test webhook request

Sending a test webhook request

To send test event request to your newly created webhook, click on "Send test webhook" button.
This button will open a modal dialog with sample payload. To send this payload to the webhook, click on "Send" button. The response from your webhook will be displayed in "Response field".

Keep in mind that Monetizr expects to receive a response with specific JSON data in it.

{
   'status': 'success'
 }

Monetizr requires to receive a valid HTTP response from webhook with HTTP 200 success status and very simple response {'status': 'success'}. If Monetizr receives any other response code with HTTP statuses 401, 404 ,500, 417 or even HTTP 200 with response {'status': 'false'}, then we consider claiming as failed. You are strongly suggested to validate claiming request validity as well.


Did this page help you?