Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wejs/we-plugin-notification
We.js notification plugin
https://github.com/wejs/we-plugin-notification
javascript notifications wejs
Last synced: about 2 months ago
JSON representation
We.js notification plugin
- Host: GitHub
- URL: https://github.com/wejs/we-plugin-notification
- Owner: wejs
- License: mit
- Created: 2014-10-04T23:33:56.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-03-08T02:40:20.000Z (almost 7 years ago)
- Last Synced: 2024-04-08T09:07:22.379Z (9 months ago)
- Topics: javascript, notifications, wejs
- Language: JavaScript
- Size: 71.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# We.js Notification plugin
Send notifications to your users, this plugin is inspired in github notifications
## Installation:
```sh
we i we-plugin-notification
```## API:
Authenticated user notifications is avaible at */notification* page or API endpoint
### How to register one new notification:
```js
// after create register one notifications
we.db.models.notification.create({
locale: res.locals.locale,
// use i18n to localize your notification title after save like in this example
title: res.locals.__('post.image.create.notification.title'),
// text related to your notification, may be one teaser
text: 'bla, bla, bla ... text here',
// this url is used to redirect use to related content
// add hostname for compatibility with emails
redirectUrl: hostname+'/post/'+record.id,
// user id of user how will be notified
userId: 10,
// user how did the notified action, optional
actorId: actor.id,
// model name, optional
modelName: 'post',
// model id, optional
modelId: record.id,
// type may be used for show icons or
// custom css in your notification
type: 'post-created-in-group'
}).then(function (r) {
// done!
// continue with your logic here ...
}).catch(done);
```## URLs
See **plugin.js** file
#### NPM Info:
[![NPM](https://nodei.co/npm/we-plugin-notification.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/we-plugin-notification/)## License
[the MIT license](LICENSE.md).