# watchmen-plugin-googlechatbot

> Notifications via ChatBot for Watchmen mainly intended for Google Hangouts Chat

Latest version **0.1.1** (published 2019-03-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install watchmen-plugin-googlechatbot
pnpm add watchmen-plugin-googlechatbot
yarn add watchmen-plugin-googlechatbot
bun add watchmen-plugin-googlechatbot
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2019-03-06 |
| First published | 2019-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 6.9 KB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Lorran Pegoretti |
| Maintainers | lorranpego |
| Keywords | notification, watchmen, chatbot, node |

## Links

- npm: https://www.npmjs.com/package/watchmen-plugin-googlechatbot
- Repository: https://github.com/lorranpego/watchmen-plugin-googlechatbot
- Homepage: https://github.com/lorranpego/watchmen-plugin-googlechatbot#readme
- Issues: https://github.com/lorranpego/watchmen-plugin-googlechatbot/issues
- npm.io page: https://npm.io/package/watchmen-plugin-googlechatbot

## Dependencies (4)

- [glob](https://npm.io/package/glob.md) ^6.0.1
- [axios](https://npm.io/package/axios.md) ^0.18.0
- [dotenv](https://npm.io/package/dotenv.md) ^1.2.0
- [handlebars](https://npm.io/package/handlebars.md) ^4.0.5

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2019-03-06
- 0.1.0 — 2019-03-06

## README

# watchmen-plugin-googlechatbot

A plugin for [watchmen](https://github.com/iloire/watchmen) to send message
notifications on service events via ChatBot (preferably Google).

Inspired by [watchmen-plugin-nodemailer](https://github.com/wiseNhammer/watchmen-plugin-nodemailer).

## Templates

This plugin comes with default templates written in
[Handlebars](http://handlebarsjs.com/)
for new outages and service back events. Each event has a body template.

You can override templates by copying the included template folder into a new
location and specifying this in your environment variables (see below).

Message templates must go in `templates/body`.

Their filenames should correspond to the watchmen event they're for. For
example, `templates/body/new-outage.hbs`. The plugin will compile all templates
when loaded and send email for any body template it loads. This means if you
want to send an email for the `latency-warning` event, simply create a template
at `templates/body/latency-warning.hbs` and restart watchmen.

```
{{service.name}} ({{service.url}}) is back online after the outage on {{date data.timestamp}}
```

Templates are passed a `service` object and a `data` object. The `data` object
contains the second argument of the event, usually data on the current or last
outage. See what the events get passed
[here: https://github.com/iloire/watchmen/blob/master/README.md#creating-your-own-plugin](https://github.com/iloire/watchmen/blob/master/README.md#creating-your-own-plugin)

## Environment variables

The following sample configures the chabot end-point and specifies a custom template
directory—overriding the default included templates as explained above.

```
WATCHMEN_BOT_URI=https://chatbot.example.com/ext/message
WATCHMEN_BOT_TEMPLATE_DIRECTORY=/home/watchmen/templates
```

##  Sending Message

This plugin will sent a message with Axios always using `POST` method to the End-point provided and include the parameter `message` on the request's body.

Example:
```js
axios.post(process.env.WATCHMEN_BOT_URI, {
    message: sMessage,
})
.then(function (response) {
    console.log("Message sent: ", sMessage);
})
.catch(function (error) {
    messageError();
});
```

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