nesthub 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/notification/README.md +53 -0
- package/dist/notification/channels/email.channel.js +2 -1
- package/dist/notification/channels/email.channel.js.map +1 -1
- package/dist/notification/channels/firebase.channel.js +15 -0
- package/dist/notification/channels/firebase.channel.js.map +1 -1
- package/dist/notification/channels/sms.channel.js +9 -6
- package/dist/notification/channels/sms.channel.js.map +1 -1
- package/dist/notification/channels/telegram.channel.d.ts +3 -0
- package/dist/notification/channels/telegram.channel.js +108 -0
- package/dist/notification/channels/telegram.channel.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -2
- package/src/notification/README.md +53 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nesthub",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "All-in-one modular toolkit for NestJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nestjs",
|
|
@@ -215,7 +215,12 @@
|
|
|
215
215
|
"rootDir": "src",
|
|
216
216
|
"testRegex": ".*\\.spec\\.ts$",
|
|
217
217
|
"transform": {
|
|
218
|
-
"^.+\\.(t|j)s$":
|
|
218
|
+
"^.+\\.(t|j)s$": [
|
|
219
|
+
"ts-jest",
|
|
220
|
+
{
|
|
221
|
+
"tsconfig": "tsconfig.test.json"
|
|
222
|
+
}
|
|
223
|
+
]
|
|
219
224
|
},
|
|
220
225
|
"moduleNameMapper": {
|
|
221
226
|
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
@@ -235,3 +235,56 @@ export class AppModule {}
|
|
|
235
235
|
| `createdAt` | `created_at` |
|
|
236
236
|
| `updatedAt` | `updated_at` |
|
|
237
237
|
| `sentAt` | `sent_at` |
|
|
238
|
+
|
|
239
|
+
## Telegram Channel
|
|
240
|
+
|
|
241
|
+
### Configuration
|
|
242
|
+
|
|
243
|
+
```typescript
|
|
244
|
+
channels: {
|
|
245
|
+
telegram: { botToken: '123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11' },
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Sending messages
|
|
250
|
+
|
|
251
|
+
**Text only** — sends via `/sendMessage`:
|
|
252
|
+
```typescript
|
|
253
|
+
await notification.send({
|
|
254
|
+
channel: 'telegram',
|
|
255
|
+
to: '1077316390',
|
|
256
|
+
content: '<b>Hello</b> from HTML',
|
|
257
|
+
});
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
**With file attachment** — sends via `/sendDocument`, `content` becomes the caption:
|
|
261
|
+
```typescript
|
|
262
|
+
await notification.send({
|
|
263
|
+
channel: 'telegram',
|
|
264
|
+
to: '1077316390',
|
|
265
|
+
content: 'Report attached',
|
|
266
|
+
attachments: [{ filename: 'report.xlsx', content: buffer }],
|
|
267
|
+
});
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
**Multiple files** — sends via `/sendMediaGroup` (single request), caption on last file:
|
|
271
|
+
```typescript
|
|
272
|
+
await notification.send({
|
|
273
|
+
channel: 'telegram',
|
|
274
|
+
to: '1077316390',
|
|
275
|
+
content: 'Monthly reports',
|
|
276
|
+
attachments: [
|
|
277
|
+
{ filename: 'jan.xlsx', content: buf1 },
|
|
278
|
+
{ filename: 'feb.xlsx', content: buf2 },
|
|
279
|
+
],
|
|
280
|
+
});
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**Attachment from file path:**
|
|
284
|
+
```typescript
|
|
285
|
+
await notification.send({
|
|
286
|
+
channel: 'telegram',
|
|
287
|
+
to: '1077316390',
|
|
288
|
+
attachments: [{ filename: 'photo.jpg', path: '/tmp/photo.jpg' }],
|
|
289
|
+
});
|
|
290
|
+
```
|