E
E
EVOSandru62021-10-31 01:14:43
API
EVOSandru6, 2021-10-31 01:14:43

Why is sendMessage not sent to telegram API with message text is empty error?

DD.

I created a bot and a group in the cart. Added the bot to the group as an admin.

I'm trying to send a message via the dock:

https://core.telegram.org/bots/api#sendmessage


curl --request POST https://api.telegram.org/bot{TOKEN}/sendMessage \
--data-raw '{
  "chat_id": "@{GROUP}",
  "text": "hoylalaley"
}'


Or like this:

curl https://api.telegram.org/bot{TOKEN}/[email protected]{GROUP}&text=hoylalaley


I catch in both cases:

{"ok":false,"error_code":400,"description":"Bad Request: message text is empty"}


Or a variant with a title:

curl -X POST \
      -H 'Content-Type: application/json' \
      -d '{"chat_id": "@{CHAT_NAME}", "text": "This is a test from curl"}' \
      https://api.telegram.org/[email protected]{BOT_TOKEN}/sendMessage


{"ok":false,"error_code":400,"description":"Bad Request: chat not found"}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
ambal245, 2021-10-31
@EVOSandru6

For a group, the chat_id must be sent in the numeric form ( chat_id=42323232), and for channels, it can also be in the form @channeliiiii [email protected].

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question