Module notifier_fcm

Delivers one event to one device through the FCM HTTP v1 API (POST https://fcm.googleapis.com/v1/projects/{project}/messages:send).

Description

Delivers one event to one device through the FCM HTTP v1 API (POST https://fcm.googleapis.com/v1/projects/{project}/messages:send).

Response handling: build_message/2 is pure and exported so payload shapes can be unit tested.

Function Index

build_message/2The FCM v1 message object for one device.
send/2Send Event to the FCM token in Target.
string_data/1FCM data values must be strings: binaries pass through, numbers and booleans are stringified, objects/arrays JSON-encoded.

Function Details

build_message/2

build_message(Event::notifier_event:event(), X2::notifier_event:target()) -> map()

The FCM v1 message object for one device.

send/2

send(Event::notifier_event:event(), Target::notifier_event:target()) -> notifier_dispatch:outcome()

Send Event to the FCM token in Target.

string_data/1

string_data(Data::map()) -> #{binary() => binary()}

FCM data values must be strings: binaries pass through, numbers and booleans are stringified, objects/arrays JSON-encoded.


Generated by EDoc