> ## Documentation Index
> Fetch the complete documentation index at: https://docs.emby.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Setup Webhooks

> Get notifications asynchronously when events occur instead of having to poll for updates

Our webhook implementation follows the [Standard Webhooks](https://www.standardwebhooks.com/) specification
and our SDKs offer:

* Built-in webhook signature validation for security
* Fully typed webhook payloads

In addition, our webhooks offer built-in support for **Slack** & **Discord**
formatting. Making it a breeze to setup in-chat notifications for your team.

## Get Started

<Info>
  **Use our sandbox environment during development**

  So you can easily test purchases, subscriptions, cancellations and refunds to
  automatically trigger webhook events without spending a dime.
</Info>

<Steps>
  <Step title="Add new endpoint">
    Head over to your organization settings and click on the `Add Endpoint` button to create a new webhook.

    <img className="block dark:hidden" src="https://mintcdn.com/absolum/oiPy8aNgYGQpGg-L/assets/integrate/webhooks/create.light.png?fit=max&auto=format&n=oiPy8aNgYGQpGg-L&q=85&s=7c73772c2d9fb4aabf2294d248612b52" width="1532" height="389" data-path="assets/integrate/webhooks/create.light.png" />

    <img className="hidden dark:block" src="https://mintcdn.com/absolum/oiPy8aNgYGQpGg-L/assets/integrate/webhooks/create.dark.png?fit=max&auto=format&n=oiPy8aNgYGQpGg-L&q=85&s=19640df6c7789c5a73bbfc9ce45e3419" width="1494" height="388" data-path="assets/integrate/webhooks/create.dark.png" />
  </Step>

  <Step title="Specify your endpoint URL">
    Enter the URL to which the webhook events should be sent.

    <img className="block dark:hidden" src="https://mintcdn.com/absolum/oiPy8aNgYGQpGg-L/assets/integrate/webhooks/url.light.png?fit=max&auto=format&n=oiPy8aNgYGQpGg-L&q=85&s=f140740bf64354587eae6bd8725e706e" width="1075" height="402" data-path="assets/integrate/webhooks/url.light.png" />

    <img className="hidden dark:block" src="https://mintcdn.com/absolum/oiPy8aNgYGQpGg-L/assets/integrate/webhooks/url.dark.png?fit=max&auto=format&n=oiPy8aNgYGQpGg-L&q=85&s=ba864860c198b609cab1f5a0c2ed5ef1" width="1068" height="398" data-path="assets/integrate/webhooks/url.dark.png" />

    <Tip>
      **Developing locally?**

      Use a tool like [ngrok](https://ngrok.com/) to tunnel webhook events to your local development environment. This will allow you to test your webhook handlers without deploying them to a live server.

      Once you have `ngrok` you can easily start a tunnel:

      ```bash theme={null}
      ngrok http 3000
      ```

      Just be sure to provide the URL ngrok gives you as the webhook endpoint on
      Polar.
    </Tip>
  </Step>

  <Step title="Choose a delivery format">
    For standard, custom integrations, leave this parameter on **Raw**. This will send a payload in JSON format.

    If you wish to send notifications to a Discord or Slack channel, you can select the corresponding format here. Polar will then adapt the payload so properly formatted messages are sent to your channel.

    <img className="block dark:hidden" src="https://mintcdn.com/absolum/oiPy8aNgYGQpGg-L/assets/integrate/webhooks/format.light.png?fit=max&auto=format&n=oiPy8aNgYGQpGg-L&q=85&s=d8aff32af7c8c2e9637e5b8ffa8053ad" width="1034" height="402" data-path="assets/integrate/webhooks/format.light.png" />

    <img className="hidden dark:block" src="https://mintcdn.com/absolum/oiPy8aNgYGQpGg-L/assets/integrate/webhooks/format.dark.png?fit=max&auto=format&n=oiPy8aNgYGQpGg-L&q=85&s=31d74aa688f21e6bdb0824d2bfc89129" width="1050" height="418" data-path="assets/integrate/webhooks/format.dark.png" />

    If you paste a Discord or Slack Webhook URL, the format will be automatically selected.
  </Step>

  <Step title="Set a secret">
    We cryptographically sign the requests using this secret. So you can easily
    verify them using our SDKs to ensure they are legitimate webhook payloads
    from Polar.

    You can set your own or generate a random one.

    <img className="block dark:hidden" src="https://mintcdn.com/absolum/oiPy8aNgYGQpGg-L/assets/integrate/webhooks/secret.light.png?fit=max&auto=format&n=oiPy8aNgYGQpGg-L&q=85&s=f2292abaf0f7542590f9b86a6ff66a29" width="1074" height="331" data-path="assets/integrate/webhooks/secret.light.png" />

    <img className="hidden dark:block" src="https://mintcdn.com/absolum/oiPy8aNgYGQpGg-L/assets/integrate/webhooks/secret.dark.png?fit=max&auto=format&n=oiPy8aNgYGQpGg-L&q=85&s=4170c16c8e476f0da68e26cadfaa2faa" width="1072" height="332" data-path="assets/integrate/webhooks/secret.dark.png" />
  </Step>

  <Step title="Subscribe to events">
    Finally, select all the events you want to be notified about and you're done 🎉
  </Step>
</Steps>

[Now, it's time to integrate our endpoint to receive events
→](/integrate/webhooks/delivery)
