Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vkatsuba/epns
:iphone: Erlang Push Notifications. APNS(Apple Push Notifications) and FCM(Firebase Cloud Messaging) Push Notifications
https://github.com/vkatsuba/epns
apns erlang fcm gcm library notifications push
Last synced: 3 months ago
JSON representation
:iphone: Erlang Push Notifications. APNS(Apple Push Notifications) and FCM(Firebase Cloud Messaging) Push Notifications
- Host: GitHub
- URL: https://github.com/vkatsuba/epns
- Owner: vkatsuba
- License: mit
- Created: 2019-06-03T15:16:08.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-09-01T16:29:36.000Z (over 3 years ago)
- Last Synced: 2024-04-29T10:46:04.218Z (9 months ago)
- Topics: apns, erlang, fcm, gcm, library, notifications, push
- Language: Erlang
- Homepage: https://github.com/vkatsuba/epns
- Size: 37.1 KB
- Stars: 13
- Watchers: 3
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Erlang Push Notifications - epns
**epns** is Erlang Push Notifications. This is a small client library for sending **FCM**/**GCM**/**APNS** Push Notifications[![Hex.pm Version](https://img.shields.io/hexpm/v/epns.svg?style=flat-square)](https://hex.pm/packages/epns)
## Goals
**epns**(**Erlang Push Notifications**) library aims to provide a simple way for push **FCM**/**GCM**/**APNS** notifications.## Documentation
### Build & Run
```sh
$ git clone https://github.com/vkatsuba/shot.git
$ cd shot
$ wget https://s3.amazonaws.com/rebar3/rebar3
$ chmod u+x ./rebar3
$ ./rebar3 shell
```
### Run `dialyzer`
```sh
$ ./rebar3 dialyzer
```
### Run `xref`
```sh
$ ./rebar3 do xref
```
### Clean `epns`
```sh
$ ./rebar3 clean
```
### Add `epns` to project: [Rebar3](https://www.rebar3.org/)
* Edit file **rebar.config**:
```erlang
{deps, [
{epns, "1.1.0"},
]}.
```## Send Push Notifications
### Send FCM by Erlang
```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-keyFCMData = #{
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
```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.htmlAPNSData = #{
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).
```# Support
[email protected]