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

# Webhooks

> Notification for events occurring within Lehjah.

Lehjah provides a robust webhook system that sends notifications for various events occurring within the platform. These webhooks allow you to listen to specific events and trigger actions based on them, enabling seamless integration with your existing workflows.

## Setting up webhooks

To start receiving webhook notifications, you need to set up the webhook URLs for both the `sandbox` and `production` environments within the no-code admin platform. Once access has been granted to either environment, navigate to the Webhook section in the admin dashboard and configure your URLs.

## Available webhook events

Lehjah sends notifications for the following events:

| Event                     | Description                                                                   |
| ------------------------- | ----------------------------------------------------------------------------- |
| `NEW_BUSINESS`            | Triggered when a new business is registered or created.                       |
| `NEW_SUBSCRIPTION`        | Triggered when a business subscribes to a plan.                               |
| `SUBSCRIPTION_REQUEST`    | Triggered when a business requests to be subscribed to a plan.                |
| `SUBSCRIPTION_EXPIRED`    | Triggered when a business's subscription expires.                             |
| `NEW_TRANSACTION_CREATED` | Triggered when a new single bank transaction is created.                      |
| `TRANSACTION_UPDATED`     | Triggered when a single bank transaction is updated.                          |
| `TRANSACTION_DELETED`     | Triggered when a single bank transaction is deleted.                          |
| `RECORD_CREATED`          | Triggered when a new record is created (e.g., invoices, bills, and restocks). |
| `RECORD_UPDATED`          | Triggered when a record is updated.                                           |
| `RECORD_DELETED`          | Triggered when a record is deleted.                                           |
| `INVENTORY_ITEM_CREATED`  | Triggered when a new inventory item is created e.g products.                  |
| `INVENTORY_ITEM_UPDATED`  | Triggered when an inventory item is updated.                                  |
| `INVENTORY_ITEM_DELETED`  | Triggered when an inventory item is deleted.                                  |

Each event notification will include relevant data that you can use to manipulate or update your system in real-time.

## Webhook reliability and retries

Lehjah follows industry-standard retry mechanisms to ensure the reliability of webhook notifications. If your server fails to acknowledge a webhook event, Lehjah will automatically retry delivering the notification. Make sure your server is configured to handle these retries and avoid processing the same event multiple times.

## Sample webhook payloads

Below are sample payloads for each webhook event. You can use these examples to understand the structure of the data you’ll receive.

<CodeGroup>
  ```json NEW_BUSINESS
  {
    "event": "NEW_BUSINESS",
    "data": {}
  }
  ```

  ```json NEW_SUBSCRIPTION
  {
    "event": "NEW_SUBSCRIPTION",
    "data": {}
  }
  ```

  ```json SUBSCRIPTION_REQUEST
  {
    "event": "SUBSCRIPTION_REQUEST",
    "data": {}
  }
  ```

  ```json SUBSCRIPTION_EXPIRED
  {
    "event": "SUBSCRIPTION_EXPIRED",
    "data": {}
  }
  ```
</CodeGroup>

## Conclusion

Webhooks provide a powerful way to stay in sync with events happening in Lehjah. Make sure to set up your webhook URLs in the admin platform and handle retries appropriately to ensure that your system responds effectively to these notifications.
