Can I install the Intercom Messenger within a Chrome extension?
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 = ml1]; o last] = l];
}
});
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.
Thanks in advance!
did you manage to get this working?
Hey
Reply
Join the Intercom Community 🎉
Already have an account? Login
Login to the community
No account yet? Create an account
Intercom Customers and Employees
Log in with SSOEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.