This software provides an Erlang client for Firebase Cloud Messaging
to enable notifications to
- Browser
- Android
- iOS notifications
- Rebar3 Build
- Migrated dependencies
- Inline configuration support [2600hz/erlang-fcm](rom https://github.com/2600hz/erlang-fcm)
- Added support for firebase http v1 cloud messaging.
- Remove qdate dependency
- Initial Release
fcm-erlang
uses rebar3
as make system. To compile
rebar3 compile
To generate release
rebar3
You can use fcm_app as a dependency in your rebar.config:
{deps , [
{fcm, {git, "https://github.com/leapsight/fcm-erlang.git", {tag, "2.1.0"}}}
]}.
rebar3 release
will create a release under _build/default/rel/fcm
directory.
$ cd _build/default/rel/fcm
$ bin/fcm console
Two connection types are supported.
start_pool_with_api_key
supports legacy apistart_pool_with_json_service_file
supports http v1 api
3> fcm:start_pool_with_api_key(foo, "google_console_server_key").
{ok,<0.60.0>}
4> fcm:start_pool_with_json_service_file(bar, "google_service_file_path.json").
{ok,<0.65.0>}
6> fcm:stop(foo).
6> fcm:stop(bar).
At any time you can send a FCM message to one or more mobile devices by calling:
7> fcm:push(RegisteredName, RegIds, Message, Retry).
Where
RegistereName
is the atom used during registrationRegId
is Registration Id specified as Erlang binary (e.g.,<<"APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx...">>
)RegIds
is a list (max 1000 elements) ofRegId
*Message
is an Erlang Map.Retry
is only valid for legacy api.
In order to understand Message
payload see Message Syntax.
or Refer to HTTP v1
The project was inspired from pdincau/gcm-erlang. I would like to thank Paolo for the same.