# promise-fcm

> Implementation of firebase cloud messaging based on promises

Latest version **1.1.11** (published 2017-01-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install promise-fcm
pnpm add promise-fcm
yarn add promise-fcm
bun add promise-fcm
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.11 |
| Published | 2017-01-26 |
| First published | 2016-06-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | olsynt |
| Maintainers | olsynt |
| Keywords | fcm, gcm, google, push, notification, push notifications, android, node-fcm, firebase, firebase cloud messaging, ios |

## Links

- npm: https://www.npmjs.com/package/promise-fcm
- Repository: https://github.com/olsynt/promise-fcm
- Homepage: https://github.com/olsynt/promise-fcm#readme
- Issues: https://github.com/olsynt/promise-fcm/issues
- npm.io page: https://npm.io/package/promise-fcm

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.13.1
- [request-promise](https://npm.io/package/request-promise.md) ^3.0.0

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 1.1.11 (latest) — 2017-01-26
- 1.1.1 — 2016-07-06
- 1.1.0 — 2016-06-30
- 1.0.2 — 2016-06-28
- 1.0.1 — 2016-06-28
- 1.0.0 — 2016-06-28

## README

promise-fcm
===================
An implementation of firebase cloud messaging using promises.

Documentation
-------------

**Installation**
`npm install promise-fcm --save`


**Function chaining**
You can more easily chain functions and call `now` to send the message.
Example :

```javascript
let sender = new FCM('serverKey');
let message = {
	key: value
};
let registrationDeviceId = 'registrationDeviceId'
sender
	.sendTo(registrationDeviceId)
	.withMessage(message)
	.now()
	.then(function (response) {
	  console.log('Request succeeded with status ', response.statusCode);
	  console.log('The response is : ' , response.body);
	})
	.catch(function (err) {
	 console.log(err)
	});
```


**Usage example**
```javascript
let sender = new FCM('serverKey');
let message = {
	to: registrationDeviceId,
	data: {}
}
sender.send(message)
      .then(function (response) {
        console.log('Request succeeded with status ', response.statusCode);
        console.log('The response is : ' , response.body);
      })
      .catch(function (err) {
    	  console.log(err)
      });
```

Changelog
-------------
* 1.1.0 :
	*  Added new methodology , function chaining. Consider use it.
	* `send` method will print as well the new message about the function chaining methodology.
	* Methods `sendTo ` `withMessage ` `withNotification `  `withCollapseKey ` and `now ` will return in`err`array of errors is exist.

TODO'S
-------------
 * Add tests
 * Add retry case
 * Add more docs

---
_Source: https://npm.io/package/promise-fcm · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
