Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fcannizzaro/firebase-messaging
NodeJS module to send firebase messages
https://github.com/fcannizzaro/firebase-messaging
firebase-messages nodejs topic
Last synced: 27 days ago
JSON representation
NodeJS module to send firebase messages
- Host: GitHub
- URL: https://github.com/fcannizzaro/firebase-messaging
- Owner: fcannizzaro
- License: mit
- Created: 2016-07-28T19:22:18.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-10-03T19:41:09.000Z (about 8 years ago)
- Last Synced: 2024-09-28T17:01:41.029Z (about 1 month ago)
- Topics: firebase-messages, nodejs, topic
- Language: JavaScript
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# firebase-messaging
[![npm](https://img.shields.io/npm/v/firebase-messaging.svg)](https://www.npmjs.com/package/firebase-messaging)NodeJS module to send firebase messages
# Install
`npm install firebase-messaging`## topic(topic, data, [, options, callback])
Send message to topic## message(to, data, [, options, callback])
Send message to device
# Options
- *collapse_key* [**String**]
- *priority* [**String**]
- *time_to_live* [**Number**]
- *delay_while_idle* [**Boolean**]
- *notification* [**Object**][See Firebase Docs](https://firebase.google.com/docs/cloud-messaging/http-server-ref)
# Usage
```javascript
const firebase = require("firebase-messaging");
var client = new firebase(CLOUD_MESSAGING_KEY);
var data = {
title: "@Test",
content: "@Content"
};var options = {
delay_while_idle : true
};client.topic("news", data, options, function(result){
// request err or message id
console.log(result);
});client.message(DEVICE_TOKEN, data);
```