https://github.com/respoke/sample-push-server
A sample server for receiving webhook events from Respoke and responding to push notification events
https://github.com/respoke/sample-push-server
Last synced: 11 months ago
JSON representation
A sample server for receiving webhook events from Respoke and responding to push notification events
- Host: GitHub
- URL: https://github.com/respoke/sample-push-server
- Owner: respoke
- License: mit
- Created: 2015-05-19T22:10:56.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-07-15T21:07:46.000Z (almost 11 years ago)
- Last Synced: 2025-02-03T10:46:24.255Z (over 1 year ago)
- Language: JavaScript
- Size: 176 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#Respoke sample push server
[](https://heroku.com/deploy?template=https://github.com/respoke/sample-push-server)
## Overview
Respoke push notifications are awesome, because you can get up and running easily without needing any backend components!
The static configuration available through the [Respoke Developer Console][] is usually enough to get you going with
standard push support for 1:1 message, group message, and call notifications.
However, some applications have push notification needs that are not a good fit for static configuration alone. For
example, if an application wants to conditionally send push notifications based on a checkbox in the application's ui,
then the application would need to control whether or not the push notification is dispatched.
It is for situations like these that Respoke provides the ability to enable "push events" via webhook and websocket.
"Push events" allow you to "take over" the process of dispatching push notifications. Instead of Respoke automatically
dispatching the push notification to the registered mobile device, the application server can apply business logic to
the push event to decide whether the notification should be sent. If the application does decide to sent the
notification, it can customize many of the properties of the notification such as
- the text of the message that is pushed
- whether the 'badge' is enabled
- the badge 'count'
- the 'category' of the notification
- the sound file to play when the notification is received
## This App
This application is an example of building a server that responds to push notification events broadcast via Respoke
webhook. This specific example demonstrates how you might dispatch push notifications to a push-enabled endpoint,
modifying the text of the push message prior to sending.
## Setup
1. deploy this application somewhere, specifying the APP_SECRET environment variable using the value provided
in the [Respoke Developer Console][]
2. configure your application to post webhook events to the url where the application is deployed
3. enable push events for "1:1 message" notifications
4. connect a mobile client to the application, have it register for push notifications, then disconnect it
5. send the mobile client's endpointId a **direct** message
If all goes well, you should see a push notification with a '🎯' prepended to it!
## License
[MIT](LICENSE)
[Respoke Developer Console]: https://portal.respoke.io