Pusher Chatkit Push Helper
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



Since Pusher's Chatkit product doesn't support push notifications natively just yet, I built a NodeJS application that polls Chatkit for new messages and calls your own API to send the push notifications.

To get started, you first need to create your config.json file. Below is an example of what this file can look like:

  "pollingInterval": 30,
  "messagesToLoad": 5,
  "chatkit": {
  "push": {
    "endpoint": "https://api.myapplication.com/v1/chatkit/push",
    "strictSSL": true,
    "auth": {
      "endpoint": "https://api.myapplication.com/v1/oauth/token",
      "grantType": "client_grant",
      "refreshGrantType": "refresh_token",
      "clientId": 2,
      "clientSecret": "j1xr1ykCGGERx120dYyGLKasdfd93uhpwivdCH3QIRDO2"

The pollingInterval attribute is in seconds. I set it to thirty seconds in my application. The messagesToLoad attribute tells the script how many messages it should download per user and room. In my application it's not super important that the user get's notified about every single message, but more important that they get notified about new messages at all. That's why I decided to keep this attribute on the low side.

The push attribute holds information about the endpoint to send the push notifications, and how to authenticate with that endpoint. I've used a standard OAuth2.0 implementation where I've issued a client that has permissions to send push notifications only.

This is what the payload data sent from the script to the push endpoint looks like

         "message":"You got 5 unread messages from Anton",

To get this helper application going you need to:

  • Set up your config.json file
  • Run npm install
  • Run npm start run. This will build the code using Babel and run it.