This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get a user | |
user = intercom.users.find(email: "[email protected]") | |
# add a company to that user | |
user.companies = [{company_id: 6, name: "Intercom"},] | |
intercom.users.save(user) | |
puts user.companies[0].name # "Intercom" | |
#remove the same company | |
user.companies = [{company_id: 6, name: "Intercom", remove: true},] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
window.intercomSettings = { | |
app_id: "hy4aeebl", | |
name: "{{current_user.name}}", // Full name | |
email: "{{current_user.email}}", // Email address | |
created_at: {{current_user.created_at | date: "%s" }} | |
}; | |
(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/hy4aeebl';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from slackclient import SlackClient | |
from flask import Flask, request | |
# Slack config | |
BOT_TOKEN = os.environ['BOTKEY'] | |
CHANNEL_NAME = "intercom-event-notifications" | |
app = Flask(__name__) | |
@app.route('/', methods=['POST']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URL = window.location.href; | |
if (URL.includes("terms")){ | |
termsPage = true; | |
} else { | |
termsPage = false; | |
} | |
var intercomSettings = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var currentdate = new Date(); | |
var currentHour = currentDate.getHours(); | |
if (if currentHour > 9 && currentHour < 5)){ | |
window.intercomSettings = { | |
app_id: APP_ID, | |
}; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (CurrentUser.loggedIn)){ | |
window.intercomSettings = { | |
app_id: APP_ID, | |
name: CurrentUser.Name, | |
email: CurrentUser.Email, | |
user_id: CurrentUser.userID, | |
}; | |
} else { | |
window.intercomSettings = { | |
app_id: APP_ID, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request | |
app = Flask(__name__) | |
@app.route('/', methods=['POST']) | |
def get_body(): | |
req = request.get_data() | |
print req | |
return req |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from intercom import Intercom, User | |
# Standard configuration using an app_id and API Key | |
Intercom.app_id = "my_app_id" | |
Intercom.app_api_key = "my-super-secret-api-key" | |
# Usng a Personal Access Token (jus replace the app_id and leave the key blank) | |
Intercom.app_id = "my-super-secret-PAT" | |
# Do whatever |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car: | |
cars = [] | |
def __init__(self, num, cheap, red, broken): | |
self.num = num | |
self.cheap = cheap | |
self.red = red | |
self.broken = broken |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# client code | |
require 'intercom' | |
#replace with your values | |
intercom = Intercom::Client.new(token: 'my_token') | |
convos = intercom.conversations.find_all(user_id: 'some_user_id', type: 'user') | |
convos.each { |x| puts x.id } | |
# sample output one | |
===> looneym ~/ruby-api-test ruby test.rb |