Skip to content

Instantly share code, notes, and snippets.

@JackGJenkins
Last active August 24, 2018 05:00
Show Gist options
  • Save JackGJenkins/589bef1dbe8d252568123d39d9419929 to your computer and use it in GitHub Desktop.
Save JackGJenkins/589bef1dbe8d252568123d39d9419929 to your computer and use it in GitHub Desktop.
Host this file (or one like it) on your server, and you can use it to unsubscribe a user in Intercom from other sources. For example, by adding a link in an email sent from another app, or directly. Pass in the Intercom user_id of the user you wish to unsubscribe as a URL query string called "id". Add your workspace ID on line 25 before using.
<html>
<head>
<meta name="robots" content="noindex, nofollow" />
<link rel="stylesheet" media="screen, projection" href="https://static.intercomassets.com/assets/unsubscribe-eb55a149a7ee2dbea877ffb83e6db0c0c66e6658fd96b802a2d4aad6ebcc7502.css" />
</head>
<body>
<div id="unsubscribe">
<h2>Your App Name Here</h2>
<div class="unsubscribed">
<h1>You are now unsubscribed</h1>
</div>
<p>Unsubscribed by accident? <a href="#" onclick="Intercom('showNewMessage', 'I have unsubscribed by accident, can you help?')">Let us know!</a></p>
</div>
<script>
(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/qm41x107';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()
var url_string = window.location.href;
var url = new URL(url_string);
var id = url.searchParams.get("id");
// Add your workspace ID here. For instructions on how to find out it, check out Ruairí's doc: https://www.intercom.com/help/faqs-and-troubleshooting/getting-set-up/where-can-i-find-my-workspace-id-app-id
var workspace_id = ""
window.intercomSettings = {
app_id: workspace_id,
user_id: id,
unsubscribed_from_emails: true
};
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment