Code Monkey home page Code Monkey logo

epns's Introduction

Erlang Push Notifications - epns

epns is Erlang Push Notifications. This is a small client library for sending FCM/GCM/APNS Push Notifications

Goals

epns(Erlang Push Notifications) library aims to provide a simple way for push FCM/GCM/APNS notifications.

Documentation

Build & Run

$ git clone https://github.com/vkatsuba/epns.git
$ cd epns
$ make

Install epns to project: Rebar3

  • Edit file rebar.config:
...
{deps, [
  ...
  {epns, {git, "git://github.com/vkatsuba/epns.git", {branch, "master"}}},
  ...
]}.
...
  • Edit file *.app.src:
...
  {applications,
   [
    ...,
    epns,
    ...
   ]},
...

Send FCM by Erlang

%%% Useful links:
%%%  * https://firebase.google.com/docs/cloud-messaging/http-server-ref
%%%  * https://developer.clevertap.com/docs/find-your-fcm-sender-id-fcm-server-api-key

FCMData = #{
  key => "TheFcmServerApiKey",
  url => "https://fcm.googleapis.com/fcm/send",
  playload => #{
    to => <<"GoogleUserToken">>,
    priority => <<"high">>,
    data => #{
      <<"title">> => <<"Some Title">>,
      <<"some_custom_field">> => true
     }}}.

epns:push(fcm, FCMData).

Send APNS by Erlang

%%% Useful links:
%%%  * https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html
%%%  * https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/BinaryProviderAPI.html
%%%  * https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/LegacyNotificationFormat.html

APNSData = #{
  cert => "/full/patch/to/cert.pem",
  key => "/full/patch/to/key.key",
  url => "gateway.push.apple.com",
  token => <<"VoipTokenOfUserDevice">>,
  playload => #{
    aps => #{alert => <<"Some Title Of Alert APNS">>},
    data => #{
      <<"title">> => <<"Some Title">>,
      <<"custom_field">> => <<"some_data">>
     }}}.

epns:push(apns, APNSData).

To be continued ...

Support

[email protected]

epns's People

Contributors

vkatsuba avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.