Skip to content

Webhooks

In complex systems, you may want to provide additional event handling via a 3rd party (maybe even your own custom server). To achieve this, Megamify offers Webhooks.

Whenever a new event is emitted, it can be forwarded to your server by making a POST request to your custom web endpoint. The event data is then passed as the JSON body of the request.

A webhook payload will look something like this:

{
  "hook": {
    "id": 2,
    "event": "com.megamify.player_created",
    "game": 3,
    "url": "https://webhook.site/5243b9d3-5287-4405-941a-d5b8f3a5ea84",
    "headers": {
      "X-Test": "Foo"
    },
    "timestamp": "2021-01-19T15:50:07.211554"
  },
  "data": {
    "id": 11467,
    "game": 3,
    "user": null,
    "display_name": "new player",
    "avatar": null,
    "country": "United States of America",
    "created_at": "2021-01-19T20:50:07.173425Z",
    "updated_at": "2021-01-19T20:50:07.173451Z"
  }
}

Need help?

View our Webhook tutorials.