Skip to main content
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.
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);
  }
});
I