manololon / telegram-bot-api-worker

Take an alternate route to Telegram Bot API :)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Telegram Bot API Worker

You can use this script to create a CloudFlare Worker to send requests to Telegram Bot API if your ISP or Web host does not allow it.

How to Deploy

  • Goto CloudFlare Dashboard and sign up/in. If you are new to CloudFlare, it may ask you to add a domain. If you don't want to add a domain, just open the above link again.

  • On the Dashboard goto Workers and verify your email if needed.

  • You will be asked to create a Workers subdomain. Enter the subdomain you want.

  • Create a Worker or Edit if you have already created one.

  • Set a short name for your worker to shorten the URL a bit.

  • Copy the code from index.js and paste into the Editor given on the Create Worker page.

  • Save and Deploy

How to use in WP Telegram plugins

After you deploy the Worker, simply copy the worker URL and paste in plugin settings. The URL may look like this
https://my-worker.mysubdomain.workers.dev

How to use outside WP Telegram

After you deploy the Worker, simply use the worker URL in place of the Telegram Bot API URL. If your worker URL is https://my-worker.mysubdomain.workers.dev, then replace https://api.telegram.org in the Bot API URL.

So, https://api.telegram.org/bot123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11/getMe

will become

https://my-worker.mysubdomain.workers.dev/bot123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11/getMe

Enjoy the talking to Telegram Bot API :)

About

Take an alternate route to Telegram Bot API :)


Languages

Language:JavaScript 100.0%