intercom / intercom-rails

The easiest way to install Intercom in a Rails app.
https://developers.intercom.io/reference
MIT License
280 stars 106 forks source link

Is there a way to listen for outgoing message events on the client-side? #333

Open summera opened 3 years ago

summera commented 3 years ago

Version info

Explanation

I am attempting to track every time a user sends us a message through the Intercom chat bubble on our site. I realize there is no hook for this in the JS SDK according to the docs. I only see onHide, 'onShow and onUnreadCountChange events. However, I'm wondering if there's maybe another way to listen to outgoing HTTP requests from the Intercom iframe that's inserted on our site which would allow me to track the outgoing requests sent to Intercom to create a conversation or message. Or maybe there is some private API I could use to get a callback when this happens? I want to track these events as part of our product analytics tracking and mixpanel integration to see how many messages each user is sending to our support team. Doing this client-side would be the easiest, most ideal solution. I tried overriding XMLHttpRequest.prototype.send within the iframe's contentWindow so that I could intercept requests, but that did not seem to work. Any other ideas? I know this is more JS related, but I didn't see a better place to submit this.

jeantristan commented 3 years ago

Hi there, Did you manage to find a solution to your problem? Regards

summera commented 3 years ago

Unfortunately no