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

# Introduction

Webhooks notify your application when events occur in the Sohar platform. They use HTTPS and deliver JSON payloads so you can respond to updates in real time.

<Steps>
  <Step title="Create a Local Endpoint">
    In your application, create a route that accepts POST requests. Below is an example using Node.js with Express:

    ```js theme={null}
    const express = require('express');
    const app = express();

    app.use(express.json());

    app.post('/webhooks', (req, res) => {
      const event = req.body;
      console.log(event);
      res.status(200).end();
    });

    app.listen(3000, () => console.log('Listening on port 3000'));
    ```

    Whenever you receive an event, respond with `HTTP 200 OK` to acknowledge receipt.

    <Tip>
      You can create a tunnel to your localhost server using a tool like
      [ngrok](https://ngrok.com/download). For example:
      `https://fa8b-9-27-207-123.ngrok-free.app/webhooks`
    </Tip>
  </Step>

  <Step title="Register Your Endpoint">
    You must use production credentials to call the [Create Webhook](/api-reference/webhooks/create-webhook) and register your endpoint, which will generate an `endpointId`. With these credentials, call the [Create Event](/api-reference/webhooks/create-webhook-event) API to subscribe your endpoint to events. For testing, the `sandbox.verification.updated` event  is recommended.

    <Tip>
      Even though webhooks are managed by production credentials, all webhook endpoints can subscribe to production and sandbox events.
    </Tip>
  </Step>

  <Step title="Test Your Endpoint">
    Send a few test requests to confirm that your endpoint receives events. If your endpoint is subscribed to the `sandbox.verification.updated` event, you can call the [Create Verification](/api-reference/verifications/create-verification-v2) API with sandbox credentials and [sandbox values](/documentation/guides/verification#sandbox-values) for testing purposes.
  </Step>

  <Step title="Deploy Your Endpoint">
    After testing, deploy your endpoint to your production environment. Use the [Create Webhook](/api-reference/webhooks/create-webhook) API to register your production URL so that live events can be delivered.
  </Step>
</Steps>
