Use incoming webhooks to get real-time updates

Listen for events on your Hang program so your integration can automatically trigger reactions.

Hang uses webhooks to notify your application when an event happens in your program. Webhooks are particularly useful for asynchronous events like when a user's profile is updated, a user makes progress on a quest, or when someone joins the program.

In order to go live, you'll have to contact us to register your webhook so Hang knows where to deliver events.

How Hang uses webhooks

A webhook enables Hang to push real-time notifications to your app. Hang uses HTTPS to send these notifications to your app as a JSON payload. You can then use these notifications to execute actions in your backend systems.

How to create a webhook endpoint

Creating a webhook endpoint is no different from creating any other page on your website. It’s an HTTPS endpoint on your server with a URL. You can use one endpoint to handle several different event types at once, or set up individual endpoints for specific events.

Handle requests from Hang

Each event is structured as an event object with a type, id, and related Hang resource. Your endpoint must check the event type and parse the payload of each event.

example event
{
  "id": "31f81cc4-2fb7-11ee-be56-0242ac120002",
  "type": "user.updated",
  "webhook_sent_at": 1633887337,
  "user": {...}
}

Last updated