Giter VIP home page Giter VIP logo

push-tester's Introduction

push-tester Node.js CI badge Node.js CI badge

npx script for testing push messages, no installation required, supports iOS & Android

Supported push message types:

  • iOS .p8 Provider Authentication Tokens
  • iOS .pem certificate/key pairs
  • iOS/Android Firebase Cloud Messages FCM (also supports GCM)

Requirements

The only requirement is having Node.js installed with the npm version that supports npx

Use

npx push-tester

normal

Running the script without any parameters will show the wizard that will guide the user to select the push message type and to enter all the required data. At the end of the wizard it will prompt the user if he wants to save the inputed data into a configuration file.

npx push-tester -c config.push.json

config

Use the -c flag to provide a configuration file when running the script. It will skip the wizard and immediately send a push message.

npx push-tester -h

help

To show help run the script with the -h flag

Configuration

Example configuration file for iOS Provider Authentication Tokens (.p8)

{
  "keyId": "KEY_ID",
  "teamId": "TEAM_ID",
  "key": "./apns.p8",
  "bundleId": "com.example.app",
  "production": false,
  "pushToken": "PUSH_TOKEN",
  "title": "test title",
  "body": "test body",
  "badge": 3,
  "sound": "default",
  "type": "p8"
}

Example configuration file for iOS cert/key pairs (.pem)

{
  "cert": "./cert.pem",
  "key": "./key.pem",
  "bundleId": "com.example.app",
  "production": false,
  "pushToken": "PUSH_TOKEN",
  "title": "title",
  "body": "body",
  "badge": 1,
  "sound": "default",
  "type": "pem"
}

Example configuration file for iOS/Android Firebase Cloud Messaging (FCM/GCM)

{
  "key": "KEY",
  "pushToken": "PUSH_TOKEN",
  "production": false,
  "title": "title",
  "body": "body",
  "type": "firebase"
}

iOS .pem cert/key pairs

For iOS push messages it's recommended to use Provider Authentication Tokens (.p8), but if you are still using cert/key pairs convert the cert.cer certificate and the key.p12 private key to .pem files.

Download the .cer file from Apple Developer and import it to the keychain (needs to be the same keychain where the certificate signing request for the push cert was created). Export the .p12 private key from the certificate.

In the directory with both the cert.cer and key.p12 run the following commands to create .pem files:

openssl x509 -in cert.cer -inform DER -outform PEM -out cert.pem
openssl pkcs12 -in key.p12 -out key.pem -nodes

To test the certificates run:

openssl s_client -connect gateway.push.apple.com:2195 -cert cert.pem -key key.pem

push-tester's People

Contributors

0xflotus avatar andrejkolar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

push-tester's Issues

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.