1.Login to your Cloudflare Dashboard.
2.Navigate to "Workers & Pages" > "Create" and create new worker.
3.Copy the content of worker.js file.
4.Paste the code in worker's code editor and fill following variables:
-
SECRET_TOKEN: Random long url safe token to protect unauthorized execution of your Cloudflare worker.
-
Send
/secret 32
command to DumpJsonBot to generate it. -
Alternatively, it can be manually created by using alphabets, numbers and by not using any special character except
_
and-
.
-
-
BOT_TOKEN: API token of your Telegram bot, can be obtained from BotFather.
5.Click deploy button, copy your worker's URL and set webhook as given here.
1.Install Git, Node.JS and NPM.
2.Clone repository:
git clone https://github.com/lawdakacoder/ShowJsonBot.git
3.Change Directory:
cd ShowJsonBot
4.Fill config.js file.
5.Setup Wrangler
-
Install wrangler
npm install wrangler
-
Login in Wrangler
npx wrangler login
-
Deploy to Cloudflare worker
npx wrangler deploy
6.Setup webhook as given here.
You can set webhook using your browser until I make a script to do it more easily.
1.Set webhook:
Replace BOT_TOKEN
, WORKER_URL
and SECRET_TOKEN
with their original values which you generated above and then open link in browser:
https://api.telegram.org/botBOT_TOKEN/setWebhook?url=WORKER_URL&allowed_updates=["message", "edited_message", "channel_post", "edited_channel_post", "message_reaction", "callback_query"]&secret_token=SECRET_TOKEN
2.Delete webhook:
Filled wrong info or need to update info? delete webhook and then you can set it again!
https://api.telegram.org/botBOT_TOKEN/deleteWebhook
List of commands that you can set in BotFather.
start - Ping the bot.
info - Show user info.
chat - Show chat info.
secret - Generate url safe token.
help - Show help text.
LawdaKaCoder: Developer of ShowJsonBot and for lawda.
Cloudflare: For workers and great documentation that no one can understand.