---
title: "Ionic Capacitor SDK: Callbacks"
description: "Handle widget events and lifecycle callbacks with the Gleap Ionic Capacitor SDK. Follow the integration code examples."
url: https://docs.gleap.ai/en/articles/578-ionic-capacitor-sdk-callbacks
collection: "Ionic / Capacitor"
updated: 2026-11-01
language: en
---

# Ionic Capacitor SDK: Callbacks

Handle widget events and lifecycle callbacks with the Gleap Ionic Capacitor SDK. Follow the integration code examples.

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
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);
  }
});
```

## Related

- [Ionic Capacitor SDK setup](https://docs.gleap.ai/en/articles/563-ionic-capacitor-sdk-setup.md)
- [Ionic Capacitor SDK: User identity](https://docs.gleap.ai/en/articles/564-ionic-capacitor-sdk-user-identity.md)
- [Ionic Capacitor SDK: Frontend tools](https://docs.gleap.ai/en/articles/565-ionic-capacitor-sdk-frontend-tools.md)
- [Ionic Capacitor SDK: Track events](https://docs.gleap.ai/en/articles/566-ionic-capacitor-sdk-track-events.md)
- [Ionic Capacitor SDK: Track pages](https://docs.gleap.ai/en/articles/567-ionic-capacitor-sdk-track-pages.md)
