How to send message to telegram bot api

My worker is returning
{ok: false, error_code: 400, description: 'Bad Request: message text is empty'}
when I make an API call to Telegram.

However, I don't see any problems with my fetch request within my worker. What am I missing in my fetch function?

const sendMessage = async (message) => {

  const token = '--'
  const data = await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
    method: "POST",
    body: JSON.stringify({
      chat_id: "---",
      text: message
    })
  })

  return await data.json()
}
Was this page helpful?