telegramx.js

WebhookClient

class

Receives updates from Telegram via webhook (incoming HTTP POST requests).

Declaration

declare class WebhookClient 

Properties

clientproperty#
readonly client: Client;

Methods

(constructor)constructor#
constructor(client: Client);

Constructs a new instance of the WebhookClient class

callbackmethod#
callback(options?: WebhookServerOptions): (req: IncomingMessage, res: ServerResponse) => void;
ParameterType
options?WebhookServerOptions
Returns (req: IncomingMessage, res: ServerResponse) => void

Build a Node http request handler suitable for mounting on an existing server or passing to .

createServer(url: string, port: number, options?: WebhookServerOptions): Promise<Server>;
ParameterType
urlstring
portnumber
options?WebhookServerOptions
Returns Promise<Server>

Register the webhook with Telegram and start a built-in HTTP server to receive updates.

handleUpdate(update: T.Update): void;
ParameterType
updateT.Update
Returns void

Feed a single raw update (already parsed) into the client's dispatcher.