[Paid] Install Intercom.io

(Jake Hower) #1

I’m looking for someone to help me install the Intercom script on my Discourse install.

Instructions can be found here.

Our Discourse installation is installed on a DO server.


We need to script to call the logged in users email address and their name (as opposed to username).

Let me know if you are interested?

(Jesse Perry) #2

It’s fairly straightforward to set up, since Discourse provides the JSON and you can just read that client-side. I’m sure you could do it a more complicated way, but this is essentially how I’ve done it with Javascript. I modified my code slightly since you’re looking for email and name, but you should be able to just embed the below code under Customize > CSS/HTML and be up & running.

Note the two places in the code of YOUR_INTERCOM_APP_ID and YOUR_DISCOURSE_DOMAIN.

Also FYI the current Intercom Messenger doesn’t play well on iOS devices on Discourse. But they could be working on an updated Messenger. And if I were to have used an updated Intercom Messenger, I would say that it works very well on iOS now :wink:

$.getJSON("https://YOUR_DISCOURSE_DOMAIN/session/current.json", function(json){
    var currentusernamefromjson = String(json.current_user.username);
    var currentuserflname = String(json.current_user.name);
    var fulllinktojson = "https://YOUR_DISCOURSE_DOMAIN/users/" + currentusernamefromjson + ".json";
    $.getJSON(fulllinktojson, function(json){
        var currentuseremail = String(json.user.email);
              Intercom('boot', {    
                    app_id: "YOUR_INTERCOM_APP_ID",
                    email: currentuseremail,
                    name: currentuserflname

	(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/YOUR_INTERCOM_APP_ID';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();

Intercom + Discourse
(Jake Hower) #3

Thanks @jesselperry!

I tried this but it still isn’t working. Could that be something to do with the fact that I don’t have SSL setup on the forum?

Or perhaps because I’m using SSO via Wordpress to control logins?

Happy to pay to have this setup for me. I can likely struggle my way around doing it myself but I don’t have the patience :slight_smile:

(Jesse Perry) #4

I’ll run a quick test with this code to see what the issue is. Before I do, I assume that your Wordpress/Discourse user emails match up with users you’ve already loaded into the Intercom admin dashboard?

SSO isn’t an issue. I actually have the same set up.

(Jake Hower) #5

They are. I have just messaged through access details to the forum if that is any help.

(system) #6

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