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

# Register WhatsApp Webhook

> Register, view and remove your lab's WhatsApp webhook.

Use the standard [Register Webhook](/webhooks/endpoint/register_webhook) API with any of the WhatsApp events: `report.send`, `bill.send`, `booking.send`, `phlebotomist.send`, `quotation.send`. They work like every other event: you can register them on their own or together with other events, and the same rules apply.

## Register

```bash theme={null}
curl --request POST \
  --url https://v2.flabs.in/client/events/subscribe \
  --header 'Authorization: Bearer <authToken>' \
  --header 'Content-Type: application/json' \
  --data '{
    "labID": "64a1b2c3d4e5f60718293a4b",
    "events": ["report.send", "bill.send"],
    "endpoint": "https://your-domain.com/flabs/whatsapp",
    "protocol": "https"
  }'
```

| Parameter | Required | Description |
| - | - | - |
| `labID` | Yes | The branch. Fetch with `GET /client/labs`. |
| `events` | Yes | Any of `report.send`, `bill.send`, `booking.send`, `phlebotomist.send`, `quotation.send` (other events can be included too). |
| `endpoint` | Yes | Your webhook URL (HTTPS). |
| `protocol` | Yes | `"https"` |
| `corporateUser` / `organization` | Party-scoped accounts only | Same as for other events: the webhook gets only that party's messages. |

Get the `authToken` from [Auth Token](/auth/endpoint/get_auth_token).

<Warning>
  **Register each WhatsApp event once per branch.** Every active webhook that includes an event gets its own copy of it, and Flabs does not stop you from registering the same event again. If two webhooks include `booking.send` (for example, you registered again instead of deleting first), every booking message reaches your side twice and the patient gets the WhatsApp twice. Check [View](#view) before registering, and to change a webhook, [delete it](#remove-or-change) first.
</Warning>

<Note>
  **Party-scoped accounts:** a catch-all webhook, if you have one, receives every message. Otherwise a message goes to the webhook of its bill's or lead's party; messages with no matching webhook go out the normal way. A bill whose corporate client and referring organization **both** have a webhook for the event is delivered to both, so make sure only one of them sends the WhatsApp.
</Note>

### Responses

Same as [Register Webhook](/webhooks/endpoint/register_webhook).

```json 200 Registered theme={null}
{
  "success": true,
  "message": "Events subscribed successfully"
}
```

## View

`GET /client/events/getAllEvents?labID=<labID>`. Your WhatsApp webhook is the row whose `events` include the WhatsApp events. If more than one row includes the same WhatsApp event, delete the extras.

```json 200 theme={null}
{
  "success": true,
  "message": "Subscribed events fetched successfully",
  "data": [
    {
      "_id": "6ac5e1f2a3b4c5d6e7f80912",
      "events": ["report.send", "bill.send"],
      "endpoint": "https://your-domain.com/flabs/whatsapp",
      "protocol": "https",
      "createdAt": "2026-10-06T07:16:25.217Z",
      "updatedAt": "2026-10-06T07:16:25.217Z"
    }
  ]
}
```

## Remove or change

`DELETE /client/events/deleteEvent/<_id>?labID=<labID>`. Flabs goes back to sending these messages the normal way immediately. To change the URL or the events, delete it and register again. Registering again **without** deleting adds a second webhook, and the messages are then sent twice.

```json 200 theme={null}
{
  "success": true,
  "message": "Subscribed event deleted successfully"
}
```

<Tip>
  Testing locally? Expose your webhook with a tunnel (e.g. ngrok) and register the public `https://` URL.
</Tip>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.