# Webhook Examples

## Webhook Overview

<figure><img src="/files/ueWoCQG58B7EFdRSw5qH" alt=""><figcaption></figcaption></figure>

```json
{
  "payload": {
    "event": "live_queue_updated",
    "timestamp": "2024-01-17T00:35:22+08:00",
    "data": {
        "id": 19242,
        "appointment_id": null,
        "appointment_date": null,
        "appointment_time": null,
        "registered_client_id": 3734,
        "registered_client_name": "Saad",
        "registered_client_phone": "923093927454",
        "client_name": "Saad",
        "state": {
          "name": "ARRIVED",
          "value": 3
        },
        "state_name": "Arrived",
        "service_id": 220,
        "service_name": "Registration",
        "staff_id": 246,
        "staff_name": "Registration",
        "notes" : {
          "items": [],
          "escapeWhenCastingToString": false
        },
        "created_at": "2024-01-17T00:35:22+08:00",
        "updated_at": "2024-01-17T00:35:22+08:00"
      }
  },
  "signature": "e43bbd70a719bc9cd51be1122cc170d6ec43dd16918b163311be622a042bcd39"
}
```

## 1. Join Live Queue

The diagram depicts a healthcare queue system where a patient joins a live queue via Chup Online, which sends the queue data to the HIS backend for processing, followed by a response confirming the patient's status in the queue.

<figure><img src="/files/xrIXV9LYUlBoDdAUG0G2" alt=""><figcaption></figcaption></figure>

```json
{
  "payload": {
  "event": "live_queue_created",
  "timestamp": "2024-01-18T20:48:00+08:00",
  "data": {
      "id": 19738,
      "appointment_id":9994,
      "appointment_date": "2024-01-18",
      "appointment_time": "20:50:00",
      "registered_client_id": 3364,
      "registered_client_name": "Jhon Doe",
      "registered_client_phone": "6012345678",
      "client_name": "Jhon Doe",
      "state": 1,
      "state_name": "In Queue",
      "service_id": 206,
      "service_name": "Registration",
      "staff_id": 262,
      "staff_name": "Registration",
      "notes": [],
      "created_at":"2024-01-18T20:48:00+08:00",
      "updated_at":"2024-01-18T20:48:00+08:00"
    }
  },
  "signature": "d8b0a38cf90f3e40b2f29b76c46fef4bef91489e7f5d6766a51e09ab3a69ae6b"
}
```

## 2. Appointment

The flow diagram shows a queue and appointment management where a patient books an appointment via 'Chup Online, which then sends the details to the HIS backend for processing. After processing, HIS sends a confirmation response back to Chup Online, with real-time appointment queue management implied.

<figure><img src="/files/lUvD8RWeQw8jpYXu5uTE" alt=""><figcaption></figcaption></figure>

```json
{
  "payload":{
    "event": "appointment_created",
    "timestamp": "2024-01-18T20:44:18+08:00",
    "data": {
      "id": 9994,
      "date": "2024-01-18",
      "time":"21:00:00",
      "original_date": "2024-01-18",
      "original_time":"21:00:00",
      "reschedule_state": 1,
      "reschedule_state_name": "Not Rescheduled",
      "rescheduled_by": 1,
      "rescheduled_by_name": "Not Rescheduled",
      "duration": 10,
      "registered_client_id": 3364,
      "registered_client_name": "Jhon Doe",
      "registered_client_phone": "60123456789",
      "client_name": "Jhon Doe",
      "client_phone": "60123456789",
      "client_email": "jhon@gmail.com", "state": 1,
      "state_name": "Booked",
      "package_type": 1,
      "package_type_name": "Self pay",
      "admin_remarks": null,
      "addons": null,
      "scheduled_by_staff_id": null,
      "scheduled_by_staff_name": null,
      "service_id": 254,
      "service_name": "Treatment Room",
      "staff_id": 263,
      "staff_name": "Treatment Room staff",
      "notes": [],
      "created_at":"2024-01-18T20:44:18+08:00",
      "updated_at": "2024-01-18T20:44:18+08:00"
    }
  },
  "signature": "0401e34e08848130d87072cfc9d1bde43367050ddd0d7ce214de198d5eaasdd"
}
```

## 3. Alert

The diagram shows a healthcare alert system where staff create an alert in Chup Online, which then sends this alert data to the HIS backend. HIS processes the alert, and a response is generated, likely to acknowledge the alert and possibly trigger further actions.

<figure><img src="/files/hINcRYVCTSpbej4rMptL" alt=""><figcaption></figcaption></figure>

```json
{
  "payload": {
    "event": "live_queue_updated",
    "timestamp": "2024-01-18T20:50:22+08:00",
    "data": {
      "id": 19738,
      "appointment_id":9994,
      "appointment_date": "2024-01-18",
      "appointment_time":"20:50:00",
      "registered_client_id": 3364, "registered_client_name": "Jhon Doe",
      "registered_client_phone": "60123456789",
      "client_name": "Jhon Doe",
      "state": 2,
      "state_name": "Alerted",
      "service_id": 206,
      "service_name": "Registration",
      "staff_id": 262,
      "staff_name": "Registration",
      "notes" : [
        {
          "id": 4731,
          "content": "Visit Transits: Registration Treatment Room",
          "user_id": 263,
          "service_id": 254,
          "client_id": 3364,
          "created_date": 1705581858,
          "updated_date": 1705581858,
          "created_at":"2024-01-18T12:44:18.000000Z",
          "updated_at": "2024-01-18T12:48:00.000000Z", "deleted_at": null,
          "model_type": "App\\Models\\Visit",
          "model_id": 19738
        }
      ],
      "created_at": "2024-01-18T20:48:00+08:00",
      "updated_at":"2024-01-18T20:50:22+08:00"
     }
  },
  "signature": "570a7740db33415aacec1f3ae4f85e6d66adb12244d61e0cbfb807957559fbff"
}
```

## 4. Serving

In the diagram, healthcare staff input a 'Serving' status into Chup Online, which then relays this status to the HIS backend through a webhook. The backend processes this information, and a response is issued, likely indicating that service is underway for a patient or client.

<figure><img src="/files/PmbheAOmSHshW693fcxX" alt=""><figcaption></figcaption></figure>

```json
{
  "payload": {
    "event": "live_queue_updated",
    "timestamp": "2024-01-18T20:50:27+08:00",
    "data": {
      "id": 19738,
      "appointment_id": 9994,
      "appointment_date": "2024-01-18",
      "appointment_time": "20:50:00",
      "registered_client_id": 3364,
      "registered_client_name": "Jhon Doe",
      "registered_client_phone": "60123456789",
      "client_name": "Jhon Doe",
      "state": 4,
      "state_name": "Serving",
      "service_id": 206,
      "service_name": "Registration",
      "staff_id": 262,
      "staff_name": "Registration",
      "notes": [
        {
          "id": 4731,
          "content": "Visit Transits : Registration → Treatment Room",
          "user_id": 263,
          "service_id": 254,
          "client_id": 3364,
          "created_date": 1705581858,
          "updated_date": 1705581858,
          "created_at": "2024-01-18T12:44:18.000000Z",
          "updated_at": "2024-01-18T12:48:00.000000Z",
          "deleted_at": null,
          "model_type": "App\\Models\\Visit",
          "model_id": 19738
        }
      ],
      "created_at": "2024-01-18T20:48:00+08:00",
      "updated_at": "2024-01-18T20:50:27+08:00"
    }
  },
  "signature": "719a73a9fa062e0c8f6bf4d1d55e84f087d53ff4f79959c3da63cc358c0d8b99"
}
```

## 5. Served

The diagram depicts a workflow where healthcare staff mark a patient as 'Served' on the Chup Online system. This status update is then sent to the HIS backend through a webhook, which processes the served data. A response is then generated, completing the process and likely updating the patient's service status in the system.

<figure><img src="/files/LNjHHDnJrhozk7wU4hQt" alt=""><figcaption></figcaption></figure>

```json
{
  "payload": {
    "event": "live_queue_updated",
    "timestamp": "2024-01-18T20:57:16+08:00",
    "data": {
      "id": 19740,
      "appointment_id": 9994,
      "appointment_date": "2024-01-18",
      "appointment_time": "20:50:00",
      "registered_client_id": 3364,
      "registered_client_name": "Jhon Doe",
      "registered_client_phone": "60123456789",
      "client_name": "Jhon Doe",
      "state": 5,
      "state_name": "Served",
      "service_id": 84,
      "service_name": "Pharmacy",
      "staff_id": 184,
      "staff_name": "Pharmacist",
      "notes": [],
      "created_at": "2024-01-18T20:54:13+08:00",
      "updated_at": "2024-01-18T20:57:16+08:00"
    }
  },
  "signature": "4085e9afdefad060b5063734b2fc624a6555b50a4d23c2d38cb27b9a180c9664"
}
```

## 6. No Show

The diagram describes a healthcare process where staff record a patient 'No Show' in Chup Online, which sends the Information to HIS backend for processing, leading to a system response.

<figure><img src="/files/bR55mD7wWCcNH66SHXuM" alt=""><figcaption></figcaption></figure>

```json
{
  "payload": {
    "event": "live_queue_updated",
    "timestamp": "2024-01-19T19:51:34+08:00",
    "data": {
      "id": 19974,
      "appointment_id": null,
      "appointment_date": null,
      "appointment_time": null,json
      "registered_client_id": 3364,
      "registered_client_name": "Jhon Doe",
      "registered_client_phone": "60123456789",
      "client_name": "Jhon Doe",
      "state": 8,
      "state_name": "No Show",
      "service_id": 206,
      "service_name": "Registration",
      "staff_id": 262,
      "staff_name": "Registration",
      "notes": [],
      "created_at": "2024-01-19T19:44:19+08:00",
      "updated_at": "2024-01-19T19:51:33+08:00"
    }
  },
  "signature": "2ff67cf8a6897ee7d0dcb1956a5600e140b57a205709c64f8f8539283d2fdb13"
}
```

### No Show (Canceled by System)

<figure><img src="/files/s4SJYXtfu7PBIW87j65h" alt=""><figcaption></figcaption></figure>

```json
{
  "payload": {
    "event": "live_queue_updated",
    "timestamp": "2024-01-29T06:24:45+08:00",
    "data": {
      "id": 44,
      "appointment_id": null,
      "appointment_date": null,
      "appointment_time": null,
      "registered_client_id": 7,
      "registered_client_name": "Jhon Doe",
      "registered_client_phone": "628123456789",
      "client_name": "Jhon Doe",
      "state": 7,
      "state_name": "Cancelled",
      "service_id": 520,
      "service_name": "Cardiology",
      "staff_id": 371,
      "staff_name": "DATO' DR. OTEH BIN MASKON",
      "notes": [
        {
          "id": 19,
          "content": "Canceled by system. No show more than 30 minutes.",
          "user_id": 383,
          "service_id": null,
          "client_id": 7,
          "created_date": null,
          "updated_date": null,
          "created_at": "2024-01-27T14:48:09.000000Z",
          "updated_at": "2024-01-27T14:48:09.000000Z",
          "deleted_at": null,
          "model_type": "App\\Models\\Visit",
          "model_id": 44
        }
      ],
      "created_at": "2024-01-26T19:27:45+08:00",
      "updated_at": "2024-01-29T06:24:45+08:00"
    }
  },
  "signature": "4bc4dcf184bf888395c11f923d3559e38d5eead4044207fcbda442555f5547e6"
}
```

### No Show - Back To Live Queue (Patient Arrived From No Show)

<figure><img src="/files/fTr9zA3Ueb8teiuhz6Cd" alt=""><figcaption></figcaption></figure>

```json
{
  "payload": {
    "event": "live_queue_updated",
    "timestamp": "2024-01-25T18:16:02+08:00",
    "data": {
      "id": 27,
      "appointment_id": null,
      "appointment_date": null,
      "appointment_time": null,
      "registered_client_id": 7,
      "registered_client_name": "Jhon Doe",
      "registered_client_phone": "628123456789",
      "client_name": "Jhon Doe",
      "state": 3,
      "state_name": "Arrived",
      "service_id": 522,
      "service_name": "Registration",
      "staff_id": 380,
      "staff_name": "Registration",
      "notes": [],
      "created_at": "2024-01-25T17:48:03+08:00",
      "updated_at": "2024-01-25T18:16:02+08:00"
    }
  },
  "signature": "d53c821c27b6f940b041771de8affde9021cea55088c0a375d683c2b60690e99"
}
```

## 7. Move

The diagram outlines a healthcare workflow where staff mark a patient as 'Moved' on Chup Online, which sends this status to the HIS backend for processing, after which a response is generated.

<figure><img src="/files/raJx7BgUHfLRjkCZI9CE" alt=""><figcaption></figcaption></figure>

```json
{
  "payload": {
    "event": "live_queue_created",
    "timestamp": "2024-01-18T20:51:26+08:00",
    "data": {
      "id": 19739,
      "appointment_id": 9994,
      "appointment_date": "2024-01-18",
      "appointment_time": "20:50:00",
      "registered_client_id": 3364,
      "registered_client_name": "Jhon Doe",
      "registered_client_phone": "60123456789",
      "client_name": "Jhon Doe",
      "state": 1,
      "state_name": "In Queue",
      "service_id": "254",
      "service_name": "Treatment Room",
      "staff_id": 261,
      "staff_name": "Treatment Room staff",
      "notes": [],
      "created_at": "2024-01-18T20:51:26+08:00",
      "updated_at": "2024-01-18T20:51:26+08:00"
    }
  },
  "signature": "f088cef9762ea040f8b477047eefe9f030b98962d1a531f442fb8fed4e5cb871"
}
```

## 8. Cancel / Delete

The diagram displays a workflow for when a client or patient decides to cancel or leave a queue on the Chup Online system. Upon cancellation, Chup Online sends the cancel payload to the HIS backend through a webhook. The HIS backend then processes this cancellation data, and a response is generated to confirm the action.

<figure><img src="/files/dR7CrRLIJ0C0vFzrmn1C" alt=""><figcaption></figcaption></figure>

```json
{
  "payload": {
    "event": "live_queue_updated",
    "timestamp": "2024-01-19T19:55:50+08:00",
    "data": {
      "id": 19974,
      "appointment_id": null,
      "appointment_date": null,
      "appointment_time": null,
      "registered_client_id": 3364,
      "registered_client_name": "Jhon Doe",
      "registered_client_phone": "60123456789",
      "client_name": "Jhon Doe",
      "state": 7,
      "state_name": "Cancelled",
      "service_id": 206,
      "service_name": "Registration",
      "staff_id": 262,
      "staff_name": "Registration",
      "notes": [],
      "created_at": "2024-01-19T19:44:19+08:00",
      "updated_at": "2024-01-19T19:55:50+08:00"
    }
  },
  "signature": "787b53a2f3e2ebb418d52ee58ccb68254bb2ed7fa0b4780d9213e16a85c9337c"
}
```

## 9. Reschedule

The diagram illustrates a workflow where a patient reschedules an appointment using Chup Online, which then communicates the reschedule information to the HIS backend, triggering a system response.

<figure><img src="/files/N8fUAJjbN4mxPS5QsMe2" alt=""><figcaption></figcaption></figure>

```json
{
  "payload": {
    "event": "appointment_updated",
    "timestamp": "2024-01-18T20:47:55+08:00",
    "data": {
      "id": 9994,
      "date": "2024-01-18",
      "time": "20:50",
      "original_date": "2024-01-18",
      "original_time": "21:00:00",
      "reschedule_state": 2,
      "reschedule_state_name": "Manual Rescheduled",
      "rescheduled_by": 3,
      "rescheduled_by_name": "Patient",
      "duration": 10,
      "registered_client_id": 3364,
      "registered_client_name": "Jhon Doe",
      "registered_client_phone": "60123456789",
      "client_name": "Jhon Doe",
      "client_phone": "60123456789",
      "client_email": "jhondoe@gmail.com",
      "state": 1,
      "state_name": "Booked",
      "package_type": 1,
      "package_type_name": "Self pay",
      "admin_remarks": null,
      "addons": null,
      "scheduled_by_staff_id": null,
      "scheduled_by_staff_name": null,
      "service_id": 254,
      "service_name": "Treatment Room",
      "staff_id": 263,
      "staff_name": "Treatment Room staff",
      "notes": [
        {
          "id": 4731,
          "content": "Visit Transits : Registration → Treatment Room",
          "user_id": 263,
          "service_id": 254,
          "client_id": 3364,
          "created_date": 1705581858,
          "updated_date": 1705581858,
          "created_at": "2024-01-18T12:44:18.000000Z",
          "updated_at": "2024-01-18T12:44:18.000000Z",
          "deleted_at": null,
          "model_type": "App\\Models\\Booking",
          "model_id": 9994
        }
      ],
      "created_at": "2024-01-18T20:44:18+08:00",
      "updated_at": "2024-01-18T20:47:55+08:00"
    }
  },
  "signature": "eadbafe84014b926e59daf3b7890bf5bc4f7e921fc4c476d4321471d758ce903"
}
```

## 10. Pharmacy (Received)

The diagram outlines a process where healthcare staff update the status of a patient to 'Received' in the Chup Online system, which then sends this update to the HIS backend. The HIS backend processes the receive data, leading to a generated response in the system.

<figure><img src="/files/ZjKJJcGpoDRna5lnL0Ha" alt=""><figcaption></figcaption></figure>

```json
{
  "payload": {
    "event": "live_queue_updated",
    "timestamp": "2024-01-19T20:46:34+08:00",
    "data": {
      "id": 19985,
      "appointment_id": null,
      "appointment_date": null,
      "appointment_time": null,
      "registered_client_id": 3364,
      "registered_client_name": "Jhon Doe",
      "registered_client_phone": "60123456789",
      "client_name": "Jhon Doe",
      "state": 3,
      "state_name": "Arrived",
      "service_id": 84,
      "service_name": "Pharmacy",
      "staff_id": 184,
      "staff_name": "Pharmacist",
      "notes": [],
      "created_at": "2024-01-19T20:45:54+08:00",
      "updated_at": "2024-01-19T20:46:34+08:00"
    }
  },
  "signature": "3237c02d08c3f9028363006780a29499e7bbc64e04cac777000f4aff2c128674"
}
```

## 11. Pharmacy (Dispense)

The diagram outlines a pharmacy workflow where staff mark a medication as dispensed in Chup Online, which sends the dispensary data to the HIS backend, leading to a response from the system.

<figure><img src="/files/dqMuOmnOPHOtJ2il0CMQ" alt=""><figcaption></figcaption></figure>

```json
{
  "payload": {
    "event": "live_queue_created",
    "timestamp": "2024-01-18T20:59:41+08:00",
    "data": {
      "id": 19742,
      "appointment_id": 9994,
      "appointment_date": "2024-01-18",
      "appointment_time": "20:50:00",
      "registered_client_id": 3364,
      "registered_client_name": "Jhon Doe",
      "registered_client_phone": "6012345678",
      "client_name": "Jhon Doe",
      "state": 1,
      "state_name": "In Queue",
      "service_id": 261,
      "service_name": "Dispensary",
      "staff_id": 184,
      "staff_name": "Pharmacist",
      "notes": [],
      "created_at": "2024-01-18T20:59:41+08:00",
      "updated_at": "2024-01-18T20:59:41+08:00"
    }
  },
  "signature": "2b9fddfa9e19699ea82d88300eec6a9fcee06b3832c40e9746e3167e48bf7fe9"
}
```

## 12. Billing Mark as Paid

The diagram illustrates a healthcare billing workflow where staff mark a service as paid in Chup Online, which then transmits this billing information to the HIS backend. Upon processing, the HIS backend generates a response to confirm the payment status.

<figure><img src="/files/MJIlRiA1rufWniHTzSUR" alt=""><figcaption></figcaption></figure>

```json
`{
  "payload": {
    "event": "live_queue_updated",
    "timestamp": "2024-01-19T20:49:56+08:00",
    "data": {
      "id": 19986,
      "appointment_id": null,
      "appointment_date": null,
      "appointment_time": null,
      "registered_client_id": 3364,
      "registered_client_name": "Jhon Doe",
      "registered_client_phone": "60123456789",
      "client_name": "Jhon Doe",
      "state": 5,
      "state_name": "Served",
      "service_id": 108,
      "service_name": "Billing",
      "staff_id": 180,
      "staff_name": "Billing staff",
      "notes": [],
      "created_at": "2024-01-19T20:48:50+08:00",
      "updated_at": "2024-01-19T20:49:56+08:00"
    }
  },
  "signature": "b9ca4e5daafa1407421ce9abc0e9a8c031fe4a3ddcffd406f2fed66bf2bf66cb"
}
```

## 13. End Visit

The diagram shows a healthcare process where staff record an 'End Visit' status in Chup Online, which then sends this update to the HIS backend, resulting in a system response to conclude the visit.

<figure><img src="/files/ys8eWHjMNgSYSqW0xXAM" alt=""><figcaption></figcaption></figure>

```json
{
  "payload": {
    "event": "live_queue_updated",
    "timestamp": "2024-01-19T20:51:53+08:00",
    "data": {
      "id": 19987,
      "appointment_id": null,
      "appointment_date": null,
      "appointment_time": null,
      "registered_client_id": 3364,
      "registered_client_name": "Jhon Doe",
      "registered_client_phone": "601234567890",
      "client_name": "Jhon Doe",
      "state": 5,
      "state_name": "Served",
      "service_id": 261,
      "service_name": "Dispensary",
      "staff_id": 184,
      "staff_name": "Pharmacist",
      "notes": [],
      "created_at": "2024-01-19T20:49:56+08:00",
      "updated_at": "2024-01-19T20:51:53+08:00"
    }
  },
  "signature": "2fbeb6613bc3da5cabf2930afbb6968f5c77bef6ad2185c32c4686062b5fc56e"
}
```


---

# 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://developers.chup.online/build-your-integration/webhook/webhook-examples.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.
