Skip to content

Commit b36687b

Browse files
committed
update readme
1 parent 5e25b2a commit b36687b

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,47 @@ currently tob supports below `KIND` of services
150150
}
151151
```
152152

153+
### Notificator
154+
155+
Currently tob supports the following types of `Notificator`. `Notificator` is where the tob will send notifications when one or more of the services you're monitoring have problems.
156+
157+
- **Discord**
158+
- **Email with SMTP**
159+
- **Slack (webhook)** https://api.slack.com/messaging/webhooks
160+
- **Telegram**
161+
- **Webhook** | For security reasons, your webhook must verify the HTTP header `x-tob-token` that is in every incoming http request.
162+
163+
Example of `x-tob-token` webhook verification in nodejs application
164+
165+
```javascript
166+
const express = require('express');
167+
const app = express();
168+
const bodyParser = require('body-parser');
169+
170+
const PORT = 3001;
171+
172+
const tobToken = "461b919e-1bf4-42db-a8ff-4f21633bbf10";
173+
174+
app.use(bodyParser.urlencoded({ extended: false }));
175+
app.use(bodyParser.json());
176+
177+
app.post('/webhook/tob', (req, res) => {
178+
const headers = req.headers;
179+
const token = headers["x-tob-token"];
180+
181+
const verifiedRequest = token === tobToken;
182+
if (!verifiedRequest) {
183+
return res.status(401).send({'message': 'token is not valid'});
184+
}
185+
186+
console.log(req.body);
187+
188+
return res.status(200).send({'message': 'webbhook received'});
189+
});
190+
191+
app.listen(PORT, () => console.log(`Server listening on port: ${PORT}`));
192+
```
193+
153194
### TODO
154195

155196
- add Kafka service

0 commit comments

Comments
 (0)