push-notify-apn: Send push notifications to mobile devices

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.


push-notify-apn is a library and command line utility that can be used to send push notifications to mobile devices. Push notifications are small messages that can be sent to apps on smart phones and tablets without the need to keep open a long lived TCP connection per app.

[Skip to ReadMe]


Change logchangelog.md
Dependenciesaeson, base (>=4.7 && <5), base16-bytestring, binary, bytestring, containers, data-default, http2, http2-client, optparse-applicative, push-notify-apn, random, text, time, tls, x509, x509-store [details]
Copyright2017 Memrange UG
AuthorHans-Christian Esperer
CategoryNetwork, Cloud, Mobile
Home pagehttps://github.com/memrange/apn#readme
Source repositoryhead: git clone https://github.com/memrange/push-notify-apn
UploadedFri Sep 1 17:05:53 UTC 2017 by hc



Maintainers' corner

For package maintainers and hackage trustees

Readme for push-notify-apn-

[back to package description]


Provide Apple Push Notifications using the new http2 api.

Sending a message is as simple as:

let sandbox = True -- Development environment
    timeout = 10   -- Minutes to keep the connection open
session <- newSession "my.key" "my.crt"
    "/etc/ssl/ca_certificates.txt" sandbox
    timeout "my.bundle.id"
let payload = alertMessage "Title" "Hello From Haskell"
    message = newMessage payload
    token   = base16EncodedToken "the-token"
success <- sendMessage session token payload
print success

command line utility

The command line utility can be used for testing your app. Use like this:

sendapn -c ../apn.crt -k ../apn.key -a \
    /etc/ssl/certs/ca-certificates.crt -b your.bundle.id -s \
    -t your-token -m "Your-message"

The -s flag means "sandbox", i.e., for apps that are deployed in a development environment.


apn.crt and apn.key are the certificate and private key of your APN certificate from apple. To extract them from a .p12 file, use openssl:

openssl pkcs12 -in mycredentials.p12 -out apn.crt -nokeys
openssl pkcs12 -in mycredentials.p12 -nodes -out apn.key -nocerts

ca-certificates.crt is a truststore that contains the root certificates that are used to verify the apn server's server certificates.