import express , { Request , Response } from 'express' ; import { Telegraf } from 'telegraf' ; const token = process . env . BOT_TOKEN ; if ( token === undefined ) { throw new Error ( 'BOT_TOKEN must be provided!' ) ; } const bot = new Telegraf ( token ) ; bot . on ( 'text' , ( ctx ) => ctx . replyWithHTML ( '<b>Hello</b>' ) ) ; const secretPath = `/telegraf/${ bot . secretPathComponent ( ) }` ; bot . telegram . setWebhook ( `https://----.localtunnel.me${ secretPath }` ) ; const app = express ( ) ; app . get ( '/' , ( req , res ) => res . send ( 'Hello World!' ) ) ; app . use ( bot . webhookCallback ( secretPath ) ) ; app . listen ( 3000 , ( ) => { console . log ( 'Example app listening on port 3000!' ) ; } ) ;