Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
export const telegramSetWebhook = async (botToken: string, options: {
url: string;
certificate?: string;
ip_address?: string;
max_connections?: number;
allowed_updates?: string[];
secret_token?: string;
}) =>
fetchJSON(
`https://api.telegram.org/bot${botToken}/setWebhook`,
{
method: "POST",
body: JSON.stringify({ ...options }),
},
);
October 23, 2023