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

# Events & Callbacks

## Capturing Partoo App Events with Callbacks

You can configure callbacks to be triggered when specific events occur in the embedded Partoo App. These callbacks allow your integration to respond to user actions such as creating a business, clicking links, or encountering errors.

<Info>
  Some callbacks are **blocking** (they prevent the default behavior unless explicitly continued), while others are **non-blocking** (the Partoo App continues its normal flow).
</Info>

***

## Setting Up a Callback

Use the `.on(eventId, callback)` method from the Partoo page instance to register an event listener.

### Syntax

```javascript theme={null}
partooPage.on(eventId, callbackFunction);
```

* `eventId` — a string identifier for the event
* `callbackFunction` — a JavaScript function that receives an event-specific `data` object

### Example

```javascript theme={null}
const subscribeCallback = (data) => {
  console.log('User subscribed to:', data);
};

partooPage.on('subscribe', subscribeCallback);
```

***

## Supported Callback Events

### `subscribe`

Triggered when a user clicks **Subscribe**.

```json theme={null}
{
  "productName": "presence_management",
  "businesses": [
    {
      "id": "5a2ab4edb12ff67cba1b7e1b",
      "org_id": 709,
      "name": "SCEP du Caire"
    }
  ]
}
```

***

### `open_business`

Triggered when a user opens a business page.

```javascript theme={null}
// data = "5a2ab4edb12ff67cba1b7e1b"
```

***

### `business_created`

Triggered after a business is created and saved.

<Warning>
  This callback does **not** block redirection to the business edit page.
</Warning>

```javascript theme={null}
// data = "5a2ab4edb12ff67cba1b7e1b"
```

***

### `business_additional_info_updated`

Triggered when additional info is updated and saved.

<Warning>
  This is a non-blocking callback.
</Warning>

```javascript theme={null}
// data = { ... }
```

***

### `business_address_updated`

Triggered when address information is updated and saved.

<Warning>
  This is a non-blocking callback.
</Warning>

```javascript theme={null}
// data = { ... }
```

***

### `business_contact_updated`

Triggered when contact details are updated.

<Warning>
  This is a non-blocking callback.
</Warning>

```javascript theme={null}
// data = { ... }
```

***

### `business_description_updated`

Triggered when a business description is updated.

<Warning>
  This is a non-blocking callback.
</Warning>

```javascript theme={null}
// data = { ... }
```

***

### `business_open_hours_updated`

Triggered when open hours are updated and saved.

<Warning>
  This is a non-blocking callback.
</Warning>

```javascript theme={null}
// data = { ... }
```

***

### `error`

Triggered when a rendering error occurs (e.g. HTTP 400, 403, 404, 500).

```javascript theme={null}
// data = 403  // HTTP status code
```

***

### `no_business_click`

Triggered when the **No Business** button is clicked.

```javascript theme={null}
partooPage.on('no_business_click', () => {
  // Handle click event
});
```

***

### `no_eligible_business_click`

Triggered when the **No Eligible Business** button is clicked.

```javascript theme={null}
partooPage.on('no_eligible_business_click', () => {
  // Handle click event
});
```

***

### `pm_view_go_to_edit_click`

Triggered when a user clicks **Edit** in the Presence Management view.

```javascript theme={null}
partooPage.on('pm_view_go_to_edit_click', () => {
  // Handle redirection to business edit
});
```

***

### `pm_view_go_to_partner_connection_click`

Triggered when a user clicks a link to go to **Partner Connection** from Presence Management.

```javascript theme={null}
partooPage.on('pm_view_go_to_partner_connection_click', () => {
  // Handle redirection to connection view
});
```

***

<Tip>
  Use callback data to sync user actions with your backend, trigger alerts, or log analytics events in real-time.
</Tip>
