Repository is archived
No commit activity in last 3 years
No release in over 3 years
An Intercom courier for Hertz.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 1.0.0
~> 3.5.0
~> 4.2.6
 Project Readme

Hertz::Courier::Intercom

THIS GEM HAS BEEN DEPRECATED. YOU SHOULD NOT REALLY USE INTERCOM TO SEND OUT EMAIL NOTIFICATIONS LIKE THIS.

Gem Version Dependency Status Code Climate

This is a Hertz courier for sending notifications to your users as Intercom conversations.

Installation

Add this line to your application's Gemfile:

gem 'hertz-courier-intercom'

And then execute:

$ bundle

Or install it yourself as:

$ gem install hertz-courier-intercom

Then, run the installer generator:

$ rails g hertz:courier:intercom:install

You will also need to expose the hertz_intercom_id method in your receiver class:

class User < ActiveRecord::Base
  include Hertz::Notifiable

  def hertz_intercom_id
    id
  end
end

If #hertz_intercom_id returns an empty value (i.e. false, nil or an empty string) at the time the job is executed, the notification will not be delivered. This allows you to programmatically enable/disable email notifications for a user:

class User
  include Hertz::Notifiable

  def hertz_intercom_id
    id if send_through_intercom?
  end
end

Usage

In order to use this courier, add :intercom to deliver_by in the notification model(s):

class CommentNotification < Hertz::Notification
  deliver_by :intercom
end

Now, add the intercom_subject and intercom_body methods in your notification class:

class CommentNotification < Hertz::Notification
  def intercom_subject
    'You have a new comment!'
  end

  def intercom_body
    'Hey man, you got a new comment waiting for you!'
  end
end

NOTE: This courier uses the deliveries API to prevent double deliveries.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/alessandro1997/hertz-courier-intercom.

License

The gem is available as open source under the terms of the MIT License.

To do

  • Allow changing the job's queue