Skip to main content
Very Popular
Go to Latest
interface ReqResHandler
import { type ReqResHandler } from "";

Abstraction over a request-response cycle, providing access to the update, as well as a mechanism for responding to the request and to end it.


update: Promise<Update>

The update object sent from Telegram, usually resolves the request's JSON body

header: string

X-Telegram-Bot-Api-Secret-Token header of the request, or undefined if not present

end: () => void

Ends the request immediately without body, called after every request unless a webhook reply was performed

respond: (json: string) => unknown | Promise<unknown>

Sends the specified JSON as a payload in the body, used for webhook replies

unauthorized: () => unknown | Promise<unknown>

Responds that the request is unauthorized due to mismatching X-Telegram-Bot-Api-Secret-Token headers

handlerReturn: any

Some frameworks (e.g. Deno's std/http listenAndServe) assume that handler returns something