Skip to content

Instantly share code, notes, and snippets.

@copyhacker
Last active September 18, 2015 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save copyhacker/a933b0a51d2292787f04 to your computer and use it in GitHub Desktop.
Save copyhacker/a933b0a51d2292787f04 to your computer and use it in GitHub Desktop.
Intercom example
class SessionController < ApplicationController
# . . .
# Typical login action
def create
# Rails code to log the user in...
# Create the Intercom API client
intercom_client ||= Intercom::Client.new(app_id: MY_APP_ID, api_key: MY_API_KEY)
# Log the event to Intercom
intercom_client.events.create(
event_name: 'logged_in',
created_at: Time.now.to_i,
user_id: current_user.id,
email: current_user.email)
end
# . . .
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment