# Webhooks

## Rekaz Webhooks Integration Guide 🚀

In Rekaz We offer integration to any 3rd party system, Webhooks allow real-time notifications when events occur in Rekaz. Configure your endpoint to receive JSON payloads for instant updates about reservations and subscriptions.

### How Rekaz Webhook Integation system works 🤔

diagram below will illustrate how Rekaz handle Webhooks

### Supported Event Types 🔔

#### Reservation Events

| Event Name                | Trigger Condition                                            |
| ------------------------- | ------------------------------------------------------------ |
| ReservationCreatedEvent   | New reservation created                                      |
| ReservationConfirmedEvent | Reservation confirmed by system                              |
| ReservationDoneEvent      | Reservation successfully completed                           |
| ReservationCancelledEvent | Reservation cancelled by user or admin                       |
| ReservationUpdatedEvent   | Reservation details updated (status, time, customer, fields) |

#### Subscription Events

| Event Name                      | Trigger Condition                            |
| ------------------------------- | -------------------------------------------- |
| SubscriptionCreatedEvent        | New subscription created                     |
| SubscriptionActivatedEvent      | Subscription becomes active                  |
| SubscriptionCancelledEvent      | Subscription cancelled                       |
| SubscriptionExpiredEvent        | Subscription reaches expiration date         |
| SubscriptionPausedEvent         | Subscription paused                          |
| SubscriptionResumedEvent        | Paused subscription resumes                  |
| SubscriptionTransferredEvent    | Subscription transferred to another customer |
| SubscriptionPauseScheduledEvent | Pause scheduled for a future date            |

### Payload Specifications 📦

#### Reservation Payload

**Properties**

| Property           | Type              | Required | Description                                          | Example                                     |
| ------------------ | ----------------- | -------- | ---------------------------------------------------- | ------------------------------------------- |
| id                 | Guid              | Required | Unique identifier for the reservation                | `5f47ac7b-8d8b-4e20-b84c-5eaf142e4f3d`      |
| startDate          | DateTime          | Required | Start time of the reservation                        | `2025-02-10T10:00:00`                       |
| endDate            | DateTime          | Required | End time of the reservation                          | `2025-02-15T15:00:00`                       |
| status             | ReservationStatus | Required | Current reservation status                           | `Confirmed`, `Cancelled`, `Pending`, `Done` |
| customStatus       | string            | Optional | Optional custom status                               | `Gifted`                                    |
| price              | decimal           | Required | Total reservation price                              | `250.00`                                    |
| discount           | decimal           | Required | Applied discount amount                              | `25.00`                                     |
| customer           | object            | Optional | Customer details (name, phone)                       | See example below                           |
| productName        | string            | Optional | Associated product name                              | `Hotel Suite`                               |
| priceName          | string            | Optional | Pricing category name                                | `Early Bird Special`                        |
| number             | string            | Optional | Reference number                                     | `RES123456`                                 |
| cancellationReason | string            | Optional | Reason for cancellation                              | `Schedule conflict`                         |
| eventName          | string            | Required | Describes the event that occurred                    | `ReservationCreatedEvent`                   |
| branchName         | string            | Required | The branch where the action/event took place         | `Malqa`                                     |
| sku                | string / null     | Optional | Stock Keeping Unit, used to track product variations | `SKU-12345` or `null`                       |
| providers          | array of objects  | Optional | List of service providers with name, number, and ID  | See example below                           |
| branchId           | Guid              | Required | Unique identifier for the branch                     | `3a1b91c4-6b25-8fac-30ba-878781378883`      |
| productId          | Guid              | Required | Unique identifier for the product                    | `a990ca2d-103e-4a78-b1d8-3c9f3fae5d30`      |
| productCategoryId  | Guid              | Required | Unique identifier for the product category           | `f10381f6-d626-4c14-bf93-bb3b54cd5766`      |
| optionId           | Guid              | Optional | Unique identifier for a selected option or variation | `3a1a7d1c-69b3-a6f4-47a4-59d6ae8a095f`      |
| customFields       | array of objects  | Optional | Dynamic custom fields with metadata                  | See example below                           |
| items              | array of objects  | Optional | Detailed pricing and option information              | See example below                           |

**Sample Reservation Payload**

```json
{
  "Id": "5f47ac7b-8d8b-4e20-b84c-5eaf142e4f3d",
  "EventName": "ReservationCreatedEvent",
  "CreatedAt": "2025-08-06T12:09:23.580635Z",
  "Data":{
    "startDate": "2025-02-10T10:00:00",
    "endDate": "2025-02-15T15:00:00",
    "status": "Confirmed",
    "customStatus": "Gifted",
    "price": 250.00,
    "discount": 25.00,
    "customer": {
      "name": "John Doe",
      "MobileNumber": "966501111111",
      "Email": "JohnDoe@gmail.com"
    },
    "productName": "Hotel Suite",
    "priceName": "Early Bird Special",
    "OptionName": "Bird Special",
    "number": "RES123456",
    "cancellationReason": "Schedule conflict",
    "Sku": "TS-B31",
    "Providers": [
      {
        "Name": "Car Wash Provider",
        "Number": 123471,
        "Id": "c1825119-0679-40d5-a5ae-52c1c7776774",
       
      }
    ],
    "BranchName": "Almalqa-District",
    "BranchId": "3a1b91c4-6b25-8fac-30ba-878781378883",
    "ProductId": "a990ca2d-103e-4a78-b1d8-3c9f3fae5d30",
    "ProductCategoryId": "f10381f6-d626-4c14-bf93-bb3b54cd5766",
    "OptionId": "3a1a7d1c-69b3-a6f4-47a4-59d6ae8a095f",
    "CustomFields": [
      {
        "Name": "cf-3528-3ed1-8ae2b6e21607",
        "Label": "Location Details",
        "Type": "String",
        "Value": "Parking Spot 2"
      },
      {
        "Name": "cf-8b5b-4968-16bad634ece2",
        "Label": "Additional Service",
        "Type": "AddOns",
        "Value": {
          "Selected": true,
          "Price": 15.00
        }
      }
    ],
    "Items": [
      {
        "PriceName": "Standard Package",
        "PriceId": "3a1bf031-b4cf-d696-025a-764b8fda7887",
        "OptionName": "Standard Package",
        "OptionId": "3a1bf031-b4cf-d696-025a-764b8fda7887",
        "Sku": "STD-PKG-001",
        "Price": 42.75
      }
    ]

  }
  
}
```

#### Subscription Payload

**Properties**

| Property     | Type               | Required | Description                             | Example                                                                              |
| ------------ | ------------------ | -------- | --------------------------------------- | ------------------------------------------------------------------------------------ |
| id           | Guid               | Required | Unique identifier for the subscription  | `9b1ac7b-3d8b-5f20-c84c-6eaf142e4f9a`                                                |
| startDate    | DateTime           | Required | Subscription start time                 | `2025-03-01T09:00:00`                                                                |
| endDate      | DateTime           | Required | Subscription end time                   | `2025-03-31T23:59:59`                                                                |
| status       | SubscriptionStatus | Required | Current subscription status             | `Pending`, `Active`, `Cancelled`, `Expired`, `Paused`, `Transferred`, `StartingSoon` |
| customStatus | string             | Optional | Optional custom status                  | `Gifted`                                                                             |
| price        | decimal            | Required | Total subscription price                | `150.00`                                                                             |
| discount     | decimal            | Required | Applied discount amount                 | `15.00`                                                                              |
| customer     | object             | Optional | Customer details (name, phone)          | See example below                                                                    |
| name         | string             | Optional | Subscription name                       | `Premium Monthly Plan`                                                               |
| number       | string             | Optional | Reference number                        | `SUB789012`                                                                          |
| code         | string             | Optional | Unique subscription code                | `PRM-2025`                                                                           |
| customFields | array of objects   | Optional | Dynamic custom fields with metadata     | See example below                                                                    |
| items        | array of objects   | Optional | Detailed pricing and option information | See example below                                                                    |
| pausedAt     | DateTime           | Optional | The scheduled pause start time          | `2025-09-19T00:00:00`                                                                |
| resumeAt     | DateTime           | Optional | The scheduled resume time               | `2025-09-21T00:00:00`                                                                |

**Sample Subscription Payload**

```json
{
  "id": "9b1ac7b-3d8b-5f20-c84c-6eaf142e4f9a",
  "startDate": "2025-03-01T09:00:00",
  "endDate": "2025-03-31T23:59:59",
  "status": "Active",
  "customStatus": "Gifted",
  "price": 150.00,
  "discount": 15.00,
  "customer": {
    "name": "Jane Smith",
    "phone": "966502222222"
  },
  "name": "Gym",
  "number": "123751",
  "code": "SUB-fzm7v",
  "customFields": [
    {
      "Name": "cf-5629-72ef-c8ef-726aabc1c967",
      "Label": "With Swimming Classes",
      "Type": "AddOns",
      "Value": {
        "Selected": true,
        "Price": 599
      }
    },
    {
      "Name": "cf-3d3a-69ee-8f12-bd1782ef897e",
      "Label": "Why are you interested in this gym",
      "Type": "String",
      "Value": "its a great gym!"
    }
  ],
  "items": [
    {
      "PriceName": "Gym",
      "PriceId": "3a1bf30e-3d45-696e-6170-71871f59ed4d",
      "OptionName": "Gym",
      "OptionId": "3a1bf30e-3d45-696e-6170-71871f59ed4d",
      "Price": 1599
    }
  ]
}
```

**Sample: SubscriptionPauseScheduledEvent**

```json
{
  "Id": "3a1c6971-030c-bf77-4dc6-d270e4c47d36",
  "EventName": "SubscriptionPauseScheduledEvent",
  "CreatedAt": "2025-09-17T10:41:49.324729Z",
  "Data": {
    "Id": "3a1c6968-73b1-94bc-5f88-670a99c7264b",
    "StartDate": "2025-09-16T21:00:00",
    "EndDate": "2025-10-20T21:00:00",
    "Status": "Active",
    "CustomStatus": null,
    "Price": 600,
    "Discount": 0,
    "Customer": {
      "Id": "3a1c5488-e8c2-3e4a-66ba-9d99cd2cc541",
      "Name": "khaled",
      "MobileNumber": "966550382585",
      "Email": null
    },
    "Name": "اشتراك مواصلات باص",
    "Number": "123496",
    "Code": "SUB-tybev",
    "CustomFields": null,
    "PausedAt": "2025-09-19T00:00:00",
    "ResumeAt": "2025-09-21T00:00:00",
    "Items": [
      {
        "PriceName": "Transportation",
        "PriceId": "3a1c40ed-f8b7-6085-690b-011cafeb0e98",
        "OptionName": "Transportation",
        "OptionId": "3a1c40ed-f8b7-6085-690b-011cafeb0e98",
        "Price": 600
      }
    ]
  }
}
```

### Implementation Guide ⚙️

* Set Your Endpoint\
  : `POST https://your-api.com/rekaz-webhooks`
* Go to `platform.rekaz.io/Identity/apikeys`
* In webhooks section add your webhook url

### Additional information ✅

**Retry Policy** ↻

* Failed webhooks are automatically retried up to 10 times
* Exponential backoff delay between retries
* Initial retry interval is short and increases with each attempt

**Success Criteria**

* Webhook is considered successful when the response status code is in the 2xx range
* Ensure your endpoint returns appropriate HTTP status codes


---

# 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.rekaz.io/webhooks.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.
