Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ gem 'ruby-openid'
gem 'rack-oauth2'
gem 'alto_guisso', git: "https://github.com/instedd/alto_guisso.git", branch: 'master'
gem 'alto_guisso_rails', git: "https://github.com/instedd/alto_guisso_rails.git", branch: 'master'
gem 'intercom-rails'

gem 'breadcrumbs_on_rails'
gem 'fast_gettext'
Expand Down
7 changes: 5 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GIT

GIT
remote: git://github.com/instedd/telemetry_rails.git
revision: b361d4cf3167a7184f77c678d77c517f5680f032
revision: db0ef5c0e72b8a944befb7b9b88beedb876b296c
branch: master
specs:
instedd_telemetry (0.0.1)
Expand Down Expand Up @@ -145,6 +145,8 @@ GEM
httpclient (2.6.0.1)
i18n (0.7.0)
ice_cube (0.6.14)
intercom-rails (0.4.0)
activesupport (> 3.0)
io-console (0.4.2)
journey (1.0.4)
jquery-rails (2.1.4)
Expand Down Expand Up @@ -290,6 +292,7 @@ DEPENDENCIES
hub_client!
ice_cube (~> 0.6.13)
instedd_telemetry!
intercom-rails
io-console
jquery-rails (~> 2.1.0)
kaminari
Expand All @@ -315,4 +318,4 @@ DEPENDENCIES
uglifier (>= 1.0.3)

BUNDLED WITH
1.10.6
1.11.2
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,13 @@ To setup and run test, once the web container is running:
$ docker-compose exec web bash
root@web_1 $ rake
```

## Intercom

Remindem supports Intercom as its CRM platform. To load the Intercom chat widget, simply start Remindem with the env variable `INTERCOM_APP_ID` set to your Intercom app id (https://www.intercom.com/help/faqs-and-troubleshooting/getting-set-up/where-can-i-find-my-workspace-id-app-id).

Remindem will forward any conversation with a logged user identifying them through their email address. Anonymous, unlogged users will also be able to communicate.

If you don't want to use Intercom, you can simply omit `INTERCOM_APP_ID` or set it to `''`.

To test the feature in development, add the `INTERCOM_APP_ID` variable and its value to the `environment` object inside the `web` service in `docker-compose.yml`.
15 changes: 11 additions & 4 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
# Copyright (C) 2011-2012, InSTEDD
#
#
# This file is part of Remindem.
#
#
# Remindem is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# Remindem is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with Remindem. If not, see <http://www.gnu.org/licenses/>.

class HomeController < ApplicationController
after_filter :intercom_shutdown, :only => [:index]

def index
add_body_class 'homepage'
end

protected
def intercom_shutdown
IntercomRails::ShutdownHelper.intercom_shutdown(session, cookies, request.domain)
end
end
8 changes: 8 additions & 0 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class SessionsController < Devise::SessionsController
after_filter :prepare_intercom_shutdown, :only => [:destroy]

protected
def prepare_intercom_shutdown
IntercomRails::ShutdownHelper.prepare_intercom_shutdown(session)
end
end
119 changes: 119 additions & 0 deletions config/initializers/intercom.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
if ENV["INTERCOM_APP_ID"]
IntercomRails.config do |config|
# == Intercom app_id
#
config.app_id = ENV["INTERCOM_APP_ID"]

# == Intercom session_duration
#
# config.session_duration = 300000
# == Intercom secret key
# This is required to enable Identity Verification, you can find it on your Setup
# guide in the "Identity Verification" step.
#
# config.api_secret = "..."

# == Enabled Environments
# Which environments is auto inclusion of the Javascript enabled for
#
config.enabled_environments = ["development", "production"]

# == Current user method/variable
# The method/variable that contains the logged in user in your controllers.
# If it is `current_user` or `@user`, then you can ignore this
#
# config.user.current = [Proc.new { current_user }]
config.user.current = Proc.new { current_user }

# == Include for logged out Users
# If set to true, include the Intercom messenger on all pages, regardless of whether
# The user model class (set below) is present.
config.include_for_logged_out_users = true

# == User model class
# The class which defines your user model
#
# config.user.model = Proc.new { User }

# == Lead/custom attributes for non-signed up users
# Pass additional attributes to for potential leads or
# non-signed up users as an an array.
# Any attribute contained in config.user.lead_attributes can be used
# as custom attribute in the application.
# config.user.lead_attributes = %w(ref_data utm_source)

# == Exclude users
# A Proc that given a user returns true if the user should be excluded
# from imports and Javascript inclusion, false otherwise.
#
# config.user.exclude_if = Proc.new { |user| user.deleted? }

# == User Custom Data
# A hash of additional data you wish to send about your users.
# You can provide either a method name which will be sent to the current
# user object, or a Proc which will be passed the current user.
#
# config.user.custom_data = {
# :plan => Proc.new { |current_user| current_user.plan.name },
# :favorite_color => :favorite_color
# }
config.user.custom_data = {
:user_id => Proc.new { |user| user.email }
}

# == Current company method/variable
# The method/variable that contains the current company for the current user,
# in your controllers. 'Companies' are generic groupings of users, so this
# could be a company, app or group.
#
# config.company.current = Proc.new { current_company }
#
# Or if you are using devise you can just use the following config
#
# config.company.current = Proc.new { current_user.company }

# == Exclude company
# A Proc that given a company returns true if the company should be excluded
# from imports and Javascript inclusion, false otherwise.
#
# config.company.exclude_if = Proc.new { |app| app.subdomain == 'demo' }

# == Company Custom Data
# A hash of additional data you wish to send about a company.
# This works the same as User custom data above.
#
# config.company.custom_data = {
# :number_of_messages => Proc.new { |app| app.messages.count },
# :is_interesting => :is_interesting?
# }

# == Company Plan name
# This is the name of the plan a company is currently paying (or not paying) for.
# e.g. Messaging, Free, Pro, etc.
#
# config.company.plan = Proc.new { |current_company| current_company.plan.name }

# == Company Monthly Spend
# This is the amount the company spends each month on your app. If your company
# has a plan, it will set the 'total value' of that plan appropriately.
#
# config.company.monthly_spend = Proc.new { |current_company| current_company.plan.price }
# config.company.monthly_spend = Proc.new { |current_company| (current_company.plan.price - current_company.subscription.discount) }

# == Custom Style
# By default, Intercom will add a button that opens the messenger to
# the page. If you'd like to use your own link to open the messenger,
# uncomment this line and clicks on any element with id 'Intercom' will
# open the messenger.
#
# config.inbox.style = :custom
#
# If you'd like to use your own link activator CSS selector
# uncomment this line and clicks on any element that matches the query will
# open the messenger
# config.inbox.custom_activator = '.intercom'
#
# If you'd like to hide default launcher button uncomment this line
# config.hide_default_launcher = true
end
end
5 changes: 4 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@

scope "(:locale)", :locale => /#{Locales.available.keys.join('|')}/ do

devise_for :users, :controllers => {:registrations => 'users/registrations', omniauth_callbacks: "omniauth_callbacks" } do
devise_for :users, :controllers => {
:registrations => 'users/registrations',
omniauth_callbacks: "omniauth_callbacks",
:sessions => "sessions"} do
get 'users/registrations/success', :to => 'users/registrations#success'
end

Expand Down