Skip to content

Instantly share code, notes, and snippets.

@thewheat
Last active May 11, 2021 15:13
Show Gist options
  • Save thewheat/a0e8701fb0e83adcf46c4f96a17336f5 to your computer and use it in GitHub Desktop.
Save thewheat/a0e8701fb0e83adcf46c4f96a17336f5 to your computer and use it in GitHub Desktop.
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

window.intercomSettings = { 
  app_id: YOUR_APP_ID
  email: EMAIL_OF_CURRENTLY_LOGGED_IN_USER
}
Attribute in Javascript code Attribute in API Attribute / Data in Web interface Type Description
app_id - - string The app_id of your Intercom app which will indicate where to store any data
email email Email string The email address of the currently logged in user (Only applicable to users)
user_id user_id User ID string The user_id address of the currently logged in user (Only applicable to users)
created_at signed_up_at (previously also remote_created_at) Signed Up timestamp The Unix timestamp in seconds when the user signed up on your app (Only applicable to users)
phone phone Phone string The phone number of the currently logged in user
name name Name string The name of the currently logged in user
last_request_at last_request_at Last seen timestamp This value can't actually be set by the Javascript API (it automatically uses the time of the last request but is a this is a reserved attribute)
custom_launcher_selector - - string The CSS selector of an element to trigger Intercom("show") in order to activate the messenger (See docs). To target an element by ID: "#id_of_element". To target elements by class ".classname_of_elements"
alignment - - string Dicate the alignment of the default launcher icon to be on the left/right. Possible values: "left" or "right" (any other value is treated as right). (See docs)
vertical_padding - - integer Move the default launcher icon vertically. Padding from bottom of screen. Minimum value: 20. Does not work on mobile. (See docs)
horizontal_padding - - integer Move the default launcher icon horizontally. Padding from right side of screen Minimum value: 20. Does not work on mobile. (See docs)
hide_default_launcher - - boolean Hide the default launcher icon. Setting to false will forcefully show the launcher icon (See docs)
unsubscribed_from_emails unsubscribed_from_emails Unsubscribed from emails boolean Sets the unsubscribe status of the record (See docs]
language_override - Language Override string Set the language of the current browser session to forcefully set a language to display (See docs)
utm_campaign utm_campaign UTM Campaign string UTM Campaign value. (See docs)
utm_content utm_content UTM Content string UTM Content value. (See docs)
utm_medium utm_medium UTM Medium string UTM Medium value. (See docs)
utm_source utm_source UTM Source string UTM Source value. (See docs)
utm_term utm_term UTM Term string UTM Term value. (See docs)
avatar avatar Avatar next to the name avatar object The avatar/profile image associated to the user (typically gathered via social profiles)
user_hash - - string Used for identity verification (Only applicable to users)
company companies List of companies company object The company the current user's session is associated to (See docs) (Only applicable to users)
companies companies List of companies array of company objects An array of companies the user is associated to (See docs) (Only applicable to users)

User Profile in Web Interface indicating corresponding attributes

image

Avatar Object

Attribute in Javascript code Attribute in API Attribute / Data in Web interface Type Description
type type - string The value is "avatar"
image_url image_url The avatar/profile picture of the record string An avatar image URL. Note: needs to be https.

Example

window.intercomSettings =  {
  app_id: YOUR_APP_ID, 
  user_id: USER_ID_OF_CURRENTLY_LOGGED_IN_USER, 
  avatar: {
    "type": "avatar", 
    "image_url" :"https://yourwebsite.com/user_id/profile.png"
  }
 }

Company Object

Attribute in Javascript code Attribute in API Attribute / Data in Web interface Type Description
id / company_id company_id Company ID The company ID of the
name name Name string The name of the company
created_at / remote_created_at remote_created_at Company created at timestamp The time the company was created in your system
plan plan Plan string The name of the plan the company is on (this would be any plans that your product/app has e.g. lite/pro/advanced/etc)
monthly_spend monthly_spend Monthly spend How much revenue the company generates for your business
user_count people People integer Does not actually update the value but is a reserved keyword
size size Company Size integer The number of employees in the company
website website Company Website string The URL for the company website
industry industry Company Industry string The industry that the company operates in

Example

window.intercomSettings =  {
  app_id: YOUR_APP_ID, 
  user_id: USER_ID_OF_CURRENTLY_LOGGED_IN_USER, 
  company: {
    company_id: "6",
    created_at: 1394531169,
    name: "Blue Sun",
    monthly_spend: 49,
    plan: "Pro",
    size: 85,
    website: "http://example.com",
    industry: "Manufacturing"
  }
}

Company Profile in Web Interface indicating corresponding attributes

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment