Giter Club home page Giter Club logo

apns-push-cmd's Introduction

APNs Command Line Push

build goreport

Send your push notifications to Apple Push Notification service from the command line using HTTP/2.

Authentication Mechanism Supported
Provider Authentication Tokens yes โœ…
APNs provider certificate yes โœ…

Installation

Download binaries for Linux, macOS and Windows.

Usage

Send a push notification to your app using certificate-based authentication:

apnscmd_linux_amd64 -cert-file app-cert.pem -cert-key app-private.pem \
    -token c7b68e4eb7d604876bf5836133479ffa49449c669f7e6b79318ae59032e83c24 \
    -topic com.my.app

Send an MDM push notification using certificate-based authentication with a PKCS#12 keystore and Base64 encoded device token:

apnscmd_linux_amd64 -cert-p12 apns.p12 -cert-pass <my password> \
    -token 'v2RwEsm69Go4aY4vSFY2pRLped2BMqETO3gDGBx7XmxKwSaKtZik7Q==' \
    -topic com.apple.mgmt.External.462ad9c3-7ca1-437b-8c6f-5575941a4ea7 \
    -mdm-magic 1AA91790-BA78-4DBF-9102-FBA06E6110C4

Send a push notification to your app using token-based authentication:

apnscmd_linux_amd64 -auth-token AuthKey_BBC42Y2321.p8 -key-id BBC42Y2321 -team-id YXB7430FC8 \
    -token c7b68e4eb7d604876bf5836133479ffa49449c669f7e6b79318ae59032e83c24 \
    -topic com.my.app

Send a custom push notification to your app using token-based authentication with the JSON message specified in the command line:

apnscmd_linux_amd64 -auth-token AuthKey_BBC42Y2321.p8 -key-id BBC42Y2321 -team-id YXB7430FC8 \
    -token c7b68e4eb7d604876bf5836133479ffa49449c669f7e6b79318ae59032e83c24 \
    -topic com.my.app -alert-json '{"aps": {"alert" : "test", "sound": "default"}, "custom":"custom value"}'

Send a custom push notification to your app using token-based authentication with the JSON message read from a file:

apnscmd_linux_amd64 -auth-token AuthKey_BBC42Y2321.p8 -key-id BBC42Y2321 -team-id YXB7430FC8 \
    -token c7b68e4eb7d604876bf5836133479ffa49449c669f7e6b79318ae59032e83c24 \
    -topic com.my.app -alert-filename custom.json

Show all available arguments:

apnscmd_linux_amd64 -h

The -auth-token argument always takes prescedence overt the -cert-* arguments.

Extract keys from PKCS#12

If you're using a PKCS#12 keystore, then it must be DER encoded. BER encoded keystores are not supported. You'll need to manually break down a BER encoded keystore into certificate and private key files.

To extract private key file from a PKCS#12 container use:

openssl pkcs12 -info -in apns-production.p12 -nodes -nocerts -out apns-private.pem

To extrcat certificate file from a PKCS#12 container use:

openssl pkcs12 -info -in apns-production.p12 -nokeys -out apns-cert.pem

Development

License

MIT

README icon by Freepik from Flaticon.

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.