Avatar

@enyo

2 public vals
Joined July 19, 2023
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { telegramSendMessage } from "https://esm.town/v/vtdocs/telegramSendMessage?v=5";
export const telegramWebhookEchoMessage = async (req: Request) => {
// Verify this webhook came from our bot
if (
req.headers.get("x-telegram-bot-api-secret-token")
!== Deno.env.get("telegramWebhookSecret")
) {
return new Response(undefined, { status: 401 });
}
// Echo back the user's message
const body = await req.json();
const text: string = body.message.text;
const chatId: number = body.message.chat.id;
await telegramSendMessage(
Deno.env.get("telegramBotToken"),
{ chat_id: chatId, text },
);
return Response.json("ok");
};
1
2
3
export function myApi(name) {
return "hi " + name;
}
Next