Skip to main content
Deno 2 is finally here 🎉️
Learn more
Very Popular
Latest
interface ReqResHandler
import { type ReqResHandler } from "https://deno.land/x/grammy@v1.31.0/convenience/frameworks.ts";

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.

Type Parameters

optional
T = void

Properties

update: Promise<Update>

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

optional
header: string

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

optional
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

optional
handlerReturn: Promise<T>

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