Last active
September 18, 2015 21:28
-
-
Save copyhacker/a933b0a51d2292787f04 to your computer and use it in GitHub Desktop.
Intercom example
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 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