mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-23 22:52:59 +03:00
docs: webhook docs added
This commit is contained in:
parent
ef120e4e40
commit
36c9d5a2fa
16
README.md
16
README.md
@ -147,6 +147,22 @@ TelegrafModule.forRootAsync({
|
||||
});
|
||||
```
|
||||
|
||||
## Webhooks
|
||||
If you want to configure a telegram bot webhook, you need to get a middleware from `TelegrafProvider` for connect it in your `main.ts` file.
|
||||
|
||||
To access it, you must use the `app.get()` method, followed by the provider reference:
|
||||
```typescript
|
||||
const telegrafProvider = app.get('TelegrafProvider');
|
||||
```
|
||||
|
||||
Now you can connect middleware:
|
||||
```typescript
|
||||
app.use(telegrafService.webhookCallback('/secret-path'));
|
||||
|
||||
// set up a webhook immediately if necessary
|
||||
telegrafService.telegram.setWebhook('https://server.tld:3000/secret-path');
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
Loading…
Reference in New Issue
Block a user