Answered

How do I install the Messenger within a Chrome extension?

  • 18 September 2020
  • 5 replies
  • 354 views

Userlevel 2
Badge

Can I install the Intercom Messenger within a Chrome extension?

icon

Best answer by Eric Fitz 18 September 2020, 13:35

View original

5 replies

Userlevel 1

Inside a Chrome extension, installing the Intercom Messenger script will not work out of the box, mainly because of the content security policy.

 

This kind of installation requires re-formatting those options for the content_security_policy section of the Google Chrome extension manifest.

 

Here is a small tool to convert them easily:

 

var s = ` i _can_t_show_you_because_it_contins_more_than_2_links_and_i_am_not_allowed_to_have_them but copy it from the abose csp help page'`;

var o={};

var last=null;

 

s.split("\n").forEach(l => {

var m;

if(m=l.match(/^\ +(.*)$/)) {

o[last].push(m[1])

}else if(m=l.match(/^(.*)\:$/)){

last = m[1]; o[last] = [];

}

});

 

s='';

Object.keys(o).forEach(key => {

s+= `${key} ${o[key].join(' ')};`

})

 

console.log(s);

 

Eventually, this will output something like:

 

onnect-src i_can_t_show_you_because_it_contins_more_than_2_links_and_i_am_not_allowed_to_have_them;

 

This is a good start for the manifest but it will need some additions, mainly related to adding the defaults of your domain or ‘self’ as well as the policies for object-src ‘self’ your_domain_mask;

 

The final one, for a development environment, looks like this:

 

"content_security_policy": "object-src 'self' i _can_t_show_you_because_it_contins_more_than_2_links_and_i_am_not_allowed_to_have_them"

 

Finally, the Intercom Messenger pops up in a window loaded from the chrome-extension:// space.

 

Hello @eric f11​ , could you be more specific on “the abose csp help page”?

What is the proper format of the content_security_policy ?

I have it like this, but it is not working. Screen Shot 2020-09-21 at 11.40.00 AM

Thanks in advance!

did you manage to get this working?

Userlevel 5
Badge +4

@Eric Fitz  With the release of Chrome’s Manifest V3 it seems like this is not possible anymore, are you aware of any way to include Intercom within a Chrome extension?   Exploring options for a new project to see if we can get the base level information about active users etc not necessarily using the chat support functions within the extension.  Thanks for any insights you can provide!

Userlevel 1

Hey @Nathan Sudds! Being entirely honest, this was information I transcribed from one of our Support Engineers. I don’t have the technical chops to suggest a workaround for Manifest V3!

Reply