# Use incoming webhooks to get real-time updates

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.

{% hint style="info" %}
In order to go live, you'll have to contact us to register your webhook so Hang knows where to deliver events.
{% endhint %}

### 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.

{% code title="example event" %}

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

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hang.com/hang-platform/webhooks/use-incoming-webhooks-to-get-real-time-updates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
