/sc_push

Push notification service Erlang API

Primary LanguageErlangApache License 2.0Apache-2.0

Push Notification Service Erlang API

Copyright (c) 2016 Silent Circle

Version: 2.0.0

Authors: Edwin Fine (efine@silentcircle.com).

References* For Apple Push technical information, see Local and Push Notification Programming Guide.

Each notification service supports different capabilities. Given the choice between having a lowest common denominator interface for ease of use but little flexibility, or allowing access to all service-specific features, this API has chosen to do mostly the latter, with one ease-of-use exception: the alert property, which is common to all services and will map to the proper service-specific API. This carries the actual message text to be displayed in the notification.

All other features such as badges, expiry times, and so on, must be provided in a service-specific container.

TODO : Add APNS documentation.

The description given is basically to show how to format the properties in Erlang.

registration_ids
List of binary strings. Each binary is a registration id for an Android device+application. Required.
collapse_key
binary(). (Binary string). Optional.
delay_while_idle
boolean(). Optional.
time_to_live
integer(). Optional.
restricted_package_name
binary(). (Binary string). Overrides default on server. Optional.
dry_run
boolean(). Optional (defaults to false)
data
Message payload data, which must be an object (Erlang proplist) that is convertible to JSON. The correspondence between the JSON and Erlang types are described in the table below.
JSONerlang
number integer() and float()
string binary()
true, false and null true, false and null
array [] and [json()]
object [{}] and [{binary() or atom(), json()}]
  • Simplest Possible properties
Notification = [
    {'registration_ids', [<<"Your android app reg id">>]},
    {'data', [{msg, <<"Would you like to play a game?">>}]}
].
  • TODO - Add more examples

Modules

sc_push
sc_push_app
sc_push_reg_resource
sc_push_reg_wm_device
sc_push_reg_wm_service
sc_push_reg_wm_tag
sc_push_sup
sc_push_svc_null
sc_push_svc_null_srv
sc_push_wm_common
sc_push_wm_helper
sc_push_wm_send_device
sc_push_wm_send_svc_appid_tok
sc_push_wm_send_svc_tok
sc_push_wm_send_tag
sc_push_wm_sup
sc_push_wm_version