Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fcmlly

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fcmlly - npm Package Compare versions

Comparing version 1.5.0 to 1.6.0

23

app.js
const unirest = require('unirest');
const GOOGLE_FCM_ENDPOINT = 'https://fcm.googleapis.com/fcm/send';
const GOOGLE_FCM_SUBSCRIBE_ENDPOINT = 'https://iid.googleapis.com/iid/v1/';

@@ -31,2 +32,21 @@ class Fcmlly {

async _subscribe(token,topic) {
return new Promise((resolve,reject)=>{
if(!this.APIKey)
throw Error('You must provide the APIKEY for your firebase applications.');
else if(typeof this.APIKey != 'string')
throw Error('Your API key is incorrect');
unirest
.get(GOOGLE_FCM_SUBSCRIBE_ENDPOINT + token + "/rel/topics/" + topic)
.headers({'Authorization': `key=${ this.APIKey }`})
.then((response) => {
resolve(response.raw_body);
})
.catch((error) => {
reject(error);
});
});
}
async pushToUser(id,title,body,data=null,click_action=null) {

@@ -58,2 +78,5 @@ const req = { notification: {

async subscribeToTopic(token, topic) {
return await this._subscribe(token,topic);
}
// async pushToUsers(ids,title,body,data=null,click_action=null) {

@@ -60,0 +83,0 @@ // const req = { notification: {

2

package.json
{
"name": "fcmlly",
"version": "1.5.0",
"version": "1.6.0",
"description": "An integration for Google FCM and Node.js",

@@ -5,0 +5,0 @@ "main": "app.js",

@@ -52,4 +52,5 @@ Fcmlly - Integrate with Google cloud messaging easily

* Subscribe a user to a topic
```.subscribeToTopic('user FCM token', 'topic name') ```
![](https://img.shields.io/github/stars/amindotb/fcmlly.svg) ![](https://img.shields.io/github/forks/amindotb/fcmlly.svg) ![](https://img.shields.io/github/tag/amindotb/fcmlly.svg) ![](https://img.shields.io/github/release/amindotb/fcmlly.svg) ![](https://img.shields.io/github/issues/amindotb/fcmlly.svg)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc