README.mdown in intercom-rails-0.3.2 vs README.mdown in intercom-rails-0.3.3
- old
+ new
@@ -15,18 +15,26 @@
```
bundle install
```
-Take note of your `app_id` from [here](https://app.intercom.io/apps/api_keys) and generate a config file:
+Take note of your `app_id` from [here](https://app.intercom.io/a/apps/_/settings/api-keys) and generate a config file:
```
rails generate intercom:config YOUR-APP-ID
```
-To make installing Intercom as easy as possible, where possible a `<script>` tag **will be automatically inserted before the closing `</body>` tag**. For most Rails apps, **you won't need to do any extra config**. Having trouble? Check out troubleshooting below.
+To make installing Intercom easy, where possible a `<script>` tag **will be automatically inserted before the closing `</body>` tag**. For most Rails apps, **you won't need to do any extra config**. Having trouble? Check out troubleshooting below.
+
+### Live Chat / Acquire
+With our [Acquire package](https://www.intercom.io/live-chat), Intercom Messenger now works with logged out users and visitors to your web site. Include the Intercom snippet on every page by setting:
+
+```ruby
+ config.include_for_logged_out_users = true
+```
+
### Disabling automatic insertion
To disable automatic insertion for a particular controller or action you can:
```ruby
@@ -149,10 +157,12 @@
config.user.custom_data = {
:plan => Proc.new { |user| user.plan.name },
:is_paid => Proc.new { |user| user.plan.present? },
:email_verified => :email_verified?
}
+ # or If User::custom_data method returns a hash
+ config.user.custom_data = Proc.new { |user| user.custom_data }
```
In some situations you'll want to set some custom data attribute specific to a request.
You can do this using the `intercom_custom_data` helper available in your controllers:
@@ -228,17 +238,10 @@
:number_of_messages => Proc.new { |app| app.messages.count },
:is_interesting => :is_interesting?
}
```
-### Live Chat / Acquire
-With our [Acquire package](https://www.intercom.io/live-chat), Intercom Messenger now works with logged out users and visitors to your web site. Include the Intercom snippet on every page by setting:
-
-```ruby
- config.include_for_logged_out_users = true
-```
-
### Messenger
Intercom includes an in-app messenger which allows a user to read messages and start conversations.
By default Intercom will add a button that opens the messenger to the page. If you want to customize the style of the link that opens the messenger:
@@ -256,10 +259,16 @@
```ruby
config.inbox.custom_activator = '.intercom-link'
```
+You can hide default launcher button, by setting
+
+```ruby
+ config.hide_default_launcher = true
+```
+
You can read more about configuring the messenger in your applications settings, within Intercom.
### Environments
By default Intercom will be automatically inserted in development and production Rails environments. If you would like to specify the environments in which Intercom should be inserted, you can do so as follows:
@@ -361,19 +370,55 @@
```erb
<%= intercom_script_tag %>
<% add_entry_to_csp_whitelist(intercom_script_tag.csp_sha256) %>
```
+## Deleting your users
+If you delete a user from your system, you should also delete them from Intercom lest they still receive messages.
+
+You can do this using the [intercom-ruby](https://github.com/intercom/intercom-ruby) gem. In the example below we're using an ActiveJob to perform the delete in the background.
+
+```
+class User
+ after_destroy { DeleteFromIntercom.perform_later(self)
+end
+
+class DeleteFromIntercom < ApplicationJob
+ def perform(user)
+ intercom = Intercom::Client.new
+ intercom.users.find(email: user.email).delete
+ end
+end
+```
+
## Running tests/specs
specs should run on a clean clone of this repo, using the following commands. (developed against ruby 2.1.2 and 1.9.3)
```
bundle install
bundle exec rake spec
or
bundle exec rspec spec/
```
+
+
+## Pull Requests
+
+- **Add tests!** Your patch won't be accepted if it doesn't have tests.
+
+- **Document any change in behaviour**. Make sure the README and any other
+ relevant documentation are kept up-to-date.
+
+- **Create topic branches**. Don't ask us to pull from your master branch.
+
+- **One pull request per feature**. If you want to do more than one thing, send
+ multiple pull requests.
+
+- **Send coherent history**. Make sure each individual commit in your pull
+ request is meaningful. If you had to make multiple intermediate commits while
+ developing, please squash them before sending them to us.
+
## Contributors
- Dr Nic Williams (@drnic) - provided a rails generator for adding the Intercom javascript tag into your layout.
- Alexander Chaychuk (@sashich) - fixed bug in user detection when users not persisted (e.g. new session view with devise).