Reading exact POST data as text/string sent to worker's self-url after making it Telegram's Webhook

I am trying to make a test worker to be used for Telegram Bot.

Let’s say my worker is at,
And I have set this URL as my Demo bot’s Webhook.

The thing I want to try is -

  1. POST some text through Bot, (e.g., “[email protected]!e Data”)
  2. I want to use that exact text as a new constant for further operation. (e.g., "const requestedText = <the exact text/string>; then other codes…)

How to do this in Worker Script without any extra library or module?

Sorry if this a really simple task for you, but I’m really a beginner.
Any help would be appreciated. :slightly_smiling_face:

You have to catch it like this inside your fetch event:

const postData = await event.request.json();
const text = postData.message.text;
const chatID =;

It seems I can’t use await inside a FetchEvent, it’s only accessible in an async function, as the error said when I was testing.

I got through half of the process.
The error 500 I was getting was due to my own browser cache.
I re-deployed the script and it is working from the web.
Now all I need to do is integrate it to work from telegram.

I still need some help here :pensive: