Global cti sidebar app not listening to instance method message sent from ticket_background app location

Hello Team,
I need to send currently opened ticket details into my cti app for applying custom logic before performing clickToDial, but i am not able to retrieve sent info inside cti_global_sidebar app.
Please help

"product": {
    "freshdesk": {
      "location": {
        "cti_global_sidebar": {
          "url": "index.html",
          "icon": "styles/images/twilio-icon.svg"
        },
        "ticket_background": {
          "url": "ticket_background.html"
        }
      }
    }

this is the manifest file

this is ticket_background app

document.addEventListener("DOMContentLoaded", function () {
  // Initialize channel
  app.initialized().then(function (_client) {
    var client = _client;
    // App activate callback
    client.events.on("app.activated", function () {
      // Disable Ticket Priority
      client.data.get("ticket").then(
        function (data) {
          client.instance.get().then(function (instance_info) {
            const cti_global_app = instance_info.find(
              (x) => x.location === "cti_global_sidebar"
            );
         
            client.instance.send({
              message: data,
              receiver: cti_global_app.instance_id,
            });
          });
        },
        function (error) {
          // failure operation
          console.log("error", error);
        }
      );
    });
  });
});

this is the listener inside global_cti_sidebar:

function onDocumentReady() {
  app
    .initialized()
    .then(function (_client) {
      window.client = _client;
      client.events.on("app.activated", onAppActivated);

      client.instance.context().then(function (context) {
        // receive message from other instances
        client.instance.receive(function (e) {
          let data = e.helper.getData();
          console.log(
            `${context.instance_id}: Received message from ${JSON.stringify(
              data.sender
            )}: Message: `,
            data.message
          );
        });

        console.log("instance API context", context);
      });
    })
    .catch(function (error) {
      console.error("The app failed to get initialized");
      console.error(error);
    });
}

but still i am not able to receive message sent ticket_background app , what am i doing wrong in here ??

If it still doesn’t work out try this :- Set the message/data to local storage whenever you need to and create a listener for storage event in your CTI app (clean the data when functionality is over). Try this out once, hope it helps :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.