Skip to content

Instantly share code, notes, and snippets.

View dorian-davis's full-sized avatar

Dorian dorian-davis

  • Atlassian
View GitHub Profile
@dorian-davis
dorian-davis / intercom_javascript_attributes.md
Created May 20, 2018 03:40 — forked from thewheat/intercom_javascript_attributes.md
Attributes for Intercom's client side Javascript integration used when installing the messenger https://developers.intercom.com/docs/js-installation

Javascript Installation Attributes

  • Intercom can be initialised with various ways For visitors
window.intercomSettings = { 
  app_id: YOUR_APP_ID
}

For Logged in users

@dorian-davis
dorian-davis / gist:c3d85393d9e3ba5f960ed26a1d772d4c
Created December 4, 2017 02:02
Add Intercom to liquid powered thinkific themes
{% if Thinkific.current_user %}
<script>
window.intercomSettings = {
app_id: "YOUR_APP_ID",
name: Thinkific.current_user.full_name, // Full name
email: Thinkific.current_user.email, // Email address
alignment: 'right',
horizontal_padding: 20,
vertical_padding: 60
};
@dorian-davis
dorian-davis / gist:c0aae18b4f0d8e5fbb05bf9db7c6cd65
Created November 2, 2017 23:10
Colourful git branch in Mac command line prompt (add to ~/.bash_profile) and automatic `nvm use` when cd into a folder containing a .nvmrc file
# check nvm version in nvmrc file (if present) and load/use it on directory change
enter_directory(){
if [ "$PWD" != "$PREV_PWD" ]; then
PREV_PWD="$PWD";
if [ -e ".nvmrc" ]; then
nvm use;
fi
fi
}
export PROMPT_COMMAND="$PROMPT_COMMAND enter_directory;"
@dorian-davis
dorian-davis / gist:b53dcc48706476aec8699cd8875879dc
Last active February 11, 2020 01:27
Grab UTM params from URL and add them to the Intercom Javascript object
<script>
// Get UTM Params
var querystring = document.location.search; // Get the string after the domain
querystring = querystring.substring(1); // Remove the leading "?"
querystring = querystring.split('&'); // Split the string in utm variables
var utms = {};
for (var i = 0; i < querystring.length; i++) {
@dorian-davis
dorian-davis / gist:ae5e886e6a736edf264226c0cf63ac9b
Last active January 22, 2020 23:43
Intercom snippet for logged-out and logged-in users for Kajabi
<script>
var APP_ID = "appid" // replace appid with your actual app id
window.intercomSettings = {
app_id: APP_ID
{% if current_site_user %}
,
name: "{{ current_site_user.name }}",
email: "{{ current_site_user.email }}",
user_id: "{{ current_site_user.id }}"
{% endif %}
@dorian-davis
dorian-davis / gist:e10c4cb00c93119bd063275721cc363d
Created October 8, 2016 04:02
Custom email template dynamic data trick. This way you can add dynamic data to custom email templates. (by default the data is hardcoded)
<img src="https://path.to.server/images/{{message.author.first_name | fallback: 'Dorian'}}.jpg" height="40" width="40" class="avatar" alt="intercomavatar">
@dorian-davis
dorian-davis / gist:10da8a91d8bfcd8fcc4b9157579014bf
Last active April 23, 2017 22:24
Looping through pages of of users using Intercom-node SDK
var Intercom = require('intercom-client');
var client = new Intercom.Client(APP_ID, API_KEY);
var counter = 0;
function logUserNames(r) {
var users = r.body.users; // set users as the variable for the body > users part of the JSON response
@dorian-davis
dorian-davis / gist:429e05b1d5876c974f918daec88811a0
Last active July 16, 2016 05:51
Interact with Intercom even when bootstrap modal is in focus
$('#myModal').on('shown', function() {
$(document).off('focusin.bs.modal');
});
@dorian-davis
dorian-davis / gist:00fffe4d19b1ee606240e7cb0d4b9342
Created June 4, 2016 06:00
Connect to Intercom API via Salesforce Callout (Apex)
String username = 'xxxxxx'; //app id
String password = 'yyyyyy'; //api key
Blob headerValue = Blob.valueOf(username + ':' + password);
String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);
@dorian-davis
dorian-davis / gist:f309b845c66ccfe49d74bbfd66723097
Created April 12, 2016 08:10
Authorize an angular HTTP post call to intercom
$http({
method: "POST",
url: "https://api.intercom.io/users/bulk",
headers: {
'Authorization':'Basic '+ btoa("vk5t941k" + ":" + "b7575206e1612ac58220fbc6c34fd57223d27181"),
'Content-Type' : 'application/json',
'Accept': 'application/json'
},
data: {
"users" : [