# adonis-webhook-notification-channel

> The Adonis Webhook Notification Channel.

Latest version **1.0.0** (published 2018-10-16) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install adonis-webhook-notification-channel
pnpm add adonis-webhook-notification-channel
yarn add adonis-webhook-notification-channel
bun add adonis-webhook-notification-channel
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-10-16 |
| First published | 2018-10-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Evgeny Razumov |
| Maintainers | enniel |
| Keywords | notifications, adonis, webhook |

## Links

- npm: https://www.npmjs.com/package/adonis-webhook-notification-channel
- Repository: https://github.com/enniel/adonis-webhook-notification-channel
- Homepage: https://github.com/enniel/adonis-webhook-notification-channel#readme
- Issues: https://github.com/enniel/adonis-webhook-notification-channel/issues
- npm.io page: https://npm.io/package/adonis-webhook-notification-channel

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.2.0
- [node-exceptions](https://npm.io/package/node-exceptions.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.0.0 (latest) — 2018-10-16

## README

# Adonis Webhook Notification Channel

Webhook Notification Channel for [adonis-notifications](https://github.com/enniel/adonis-notifications).

[![Build Status](https://travis-ci.org/enniel/adonis-webhook-notification-channel.svg?branch=master)](https://travis-ci.org/enniel/adonis-webhook-notification-channel)
[![Coverage Status](https://coveralls.io/repos/github/enniel/adonis-webhook-notification-channel/badge.svg?branch=master)](https://coveralls.io/github/enniel/adonis-webhook-notification-channel?branch=master)

## Installation

1. Add package:

```bash
$ npm i adonis-webhook-notification-channel --save
```
or

```bash
$ yarn add adonis-webhook-notification-channel
```

2. Register provider inside the your `start/app.js` file.

```js
const providers = [
  ...
  'adonis-webhook-notification-channel/providers/WebhookNotificationChannelProvider',
  ...
]
```

## Usage example

```js
// app/Model/Webhook.js
const Lucid = use('Lucid')

class Webhook extends Lucid {
  static get traits () {
    return [
      '@provider:Notifiable'
    ]
  }

  routeNotificationForWebhook () {
    return this.url
  }
}

module.exports = User
```

```js
// app/Notifications/MyNotification.js
const WebhookMessage = use('WebhookMessage')

class MyNotification {
  constructor(body) {
    this.body = JSON.stringify(body)
  }

  via () {
    return ['webhook']
  }

  toWebhook () {
    const message = new WebhookMessage()
    message
      .body(this.body)
      .header('content-type', 'application/json')
    return message
  }
}

module.exports = MyNotification
```

```js
const Notifications = use('Notifications')

...
const webhooks = await Webhook.all()

await Notifications.send(webhooks, new MyNotification({
  payload: {
    text: `It's works!!!`
  }
}))
...

```

## Credits

- [Evgeni Razumov](https://github.com/enniel)

## Support

Having trouble? [Open an issue](https://github.com/enniel/adonis-webhook-notification-channel/issues/new)!

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

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