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

# Callbacks

Use the following callbacks to get notified on certain state changes of the Gleap widget. This enables you to create an even deeper integration with Gleap.

```javascript theme={null}
Gleap.setEventCallback((message, err) => {
  const { name, data } = message;

  if (name === "open") {
    // Widget openend
  }
  if (name === "close") {
    // Widget openend
  }
  if (name === "notification-count-updated") {
    // Notification count changed
    console.log("Unread notifications", data);
  }
  if (name === "feedback-sent") {
    // Feedback sent
    console.log("Form data: ", data);
  }
  if (name === "outbound-sent") {
    // Feedback sent
    console.log("Outbound data: ", data);
  }
  if (name === "flow-started") {
    // Flow started
    console.log("Flow: ", data);
  }
  if (name === "error-while-sending") {
    // Error while sending
  }
  if (name === "custom-action-called") {
    // Custom action called
    console.log("Custom action: ", data);
  }
});
```
