WordPress Callbacks

I’m new to all of this, but where I do put the callback javascript codes within WordPress? I’ve tried putting the following code using a plugin called Headers and Footers and it does not work.

CometChatWidget.launch({
  // Refer to the docked or embedded layout
}).then(response => {

  // OPTIONAL: This is called in the success callback of launch method
  CometChatWidget.on("onMessageReceived", (args) => {
    console.log("CometChatWidget onMessageReceived", args);
  });
});

Hi @matt0400 ,
This should work in all pages which has the short code. You need to use just the below code snippet:
CometChatWidget.on(“onMessageReceived”, (args) => {
console.log(“CometChatWidget onMessageReceived”, args);
});

Could you please try this and let us know how it goes?

Hey @matt0400,

I hope this suggestion was helpful in resolving the issue.
Please write to us at help@cometchat.com for any further technical help.

Regards,
Provesha

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