You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+39Lines changed: 39 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,3 +33,42 @@ Once your Express application is deployed, it is important to get notified of an
33
33
34
34
```
35
35
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`.
0 commit comments