No commit activity in last 3 years
No release in over 3 years
Send fcm pushes via hey-you using google fcm protocol
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.15
~> 13.0
~> 3.0
~> 3.4

Runtime

~> 0.14
>= 1.4.2
~> 0.18
 Project Readme

Hey, You, FCM!

Build StatusGem Version

Send fcm pushes via hey-you gem using google fcm protocol

Installation

Add this line to your application's Gemfile:

gem 'hey-you-fcm-push'

And then execute:

$ bundle

Or install it yourself as:

$ gem install hey-you-fcm-push

Usage

After load gem you can send FCM pushes via hey-you.

For example:

# config/notifications.yml
events:
  say_hello:
    # ...
    fcm_push:
      topic: 'users_topic'
      notification:
        title: 'Hey!'
        body: 'Hey, %{name}!'
      android:
        notification:
          title: 'Hey, Android'
          body: 'Hey, %{name}!'
      webpush:
        notification:
          title: 'Hey, Webpush'
          body: 'Hey, %{name}!'
      apns:
        payload:
          hello: 'world'
      fcm_options:
        analytics_label: label
      push_data:
        hello: 'world'

More about format: https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages

# config/initalizers/hey-you.rb
HeyYou::Config.configure do
  # ... base hey-you configuration ...
  
  # FCM project_id
  config.fcm_push.project_id = 'my-project-12345'
  
  # Google FCM server credentials file
  #
  # !ATTENTION! this setter will rewrite your ENV["GOOGLE_APPLICATION_CREDENTIALS"]. If
  # GOOGLE_APPLICATION_CREDENTIALS has been set to your environment already just skip this setter.
  config.fcm_push.credentials_file = '/path/to/credentials.json'
end

ATTENTION: setter config.fcm_push.credentials_file= will rewrite your ENV["GOOGLE_APPLICATION_CREDENTIALS"]. If GOOGLE_APPLICATION_CREDENTIALS has been set to your environment already just skip this setter.

# // somewhere in your app 
builder = HeyYou::Builder.new('events.say_hello', name: "Jonny") 
HeyYou::Channels::FcmPush.send!(builder, token: 'token') #=> { message_id: 'message_id' }

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To run tests execute make test.

To install this gem onto your local machine, run bundle exec rake install.