From 36c9d5a2fa90e890f7abf97acad0686fdf6d04cd Mon Sep 17 00:00:00 2001 From: Aleksandr Bukhalo Date: Fri, 24 Apr 2020 17:56:55 +0300 Subject: [PATCH] docs: webhook docs added --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 33c3b98..f81abb4 100644 --- a/README.md +++ b/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).