Skip to content

Commit 7384cbd

Browse files
committed
version 1.5.0
1 parent 7316a22 commit 7384cbd

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,42 @@ Once your Express application is deployed, it is important to get notified of an
3333

3434
```
3535
Voila, from now you get an instant notification to your Telegram, and immediately fix that bug :).
36+
37+
# API
38+
```js
39+
app.use(expressNotifyTelegram(config, opts));
40+
```
41+
### Configuration (`config`) [required]
42+
43+
##### `botToken` (required)
44+
The secret token (string) you got from [BotFather](https://t.me/botfather).
45+
46+
##### `chatId` (required)
47+
The number you got from the CLI (use the instructions above).
48+
49+
### Options (`opts`) [optional]
50+
#### `exclude` (optional)
51+
An array of `statusCode`s to ignore.
52+
Example: `{ exclude: [404, 502] }` skips all notifications for 404 and 502 `statusCode`s.
53+
54+
Defaults to `[]`.
55+
56+
**Note:** This field has the highest priority. Even if you set `enable4xx` or `enable5xx` to `true`, and some values intersect with this array, those `statusCode`s get ignored.
57+
#### `enable4xx` (optional)
58+
Boolean value. If true, you will get notifications for 4xx error codes.
59+
60+
Defaults to `true`.
61+
#### `sound4xx` (optional)
62+
Boolean value. If true, you will get 4xx notifications with sound.
63+
64+
Defaults to `false`.
65+
**Note:** This is ignored if `enable4xx` is `false`.
66+
#### `enable5xx` (optional)
67+
Boolean value. If true, you will get notifications for 5xx error codes.
68+
69+
Defaults to `true`.
70+
#### `sound5xx` (optional)
71+
Boolean value. If true, you will get 5xx notifications with sound.
72+
73+
Defaults to `true`.
74+
**Note:** This is ignored if `enable5xx` is `false`.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "express-notify-telegram",
3-
"version": "1.4.0",
3+
"version": "1.5.0",
44
"description": "A simple Express middleware to notify errors into Telegram",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)