Home telegram-bot Telegram: Sending a personal message

Telegram: Sending a personal message

Author

Date

Category

I want to send personal messages in the telegram, just turning on the URL with the token and the necessary parameters. Is it possible?
Here I got a token and he worker, and made the following query:

https://api.telegram.org/bot142xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/[email protected]_name& ;text=hello + World

But unfortunately in response comes:

{"ok": false, "error_code": 400, "description": "[Error]: Bad Request: Channel NOT FOUND "}

p.s. Please do not kick if a question is too stupid) Messages will send a router))


Answer 1

First created a bot.

After that, they created a chat and added a bot to it:

  • you go to the bot on the page
  • click on top bar, on the name
  • Further options – & gt; Add to group
  • and choose any chat

and then you can already get a chat ID with a script through GetUpdates (Bott Story),
Here you can read https://core.telegram.org/bots/api


Answer 2, Authority 400%

The problem of your request was that you, trying to send a message in PM, as the Chat_id parameter passed the username of the user. However, the Bot API allows in this parameter only the channel or chat ID. Accordingly, to send messages to a personal user, you need to first find out his id. You get the ID of each user, which will write to you, in the user object. It is convenient to recognize your ID through a special bot @showjsonbot . It may also seem comfortable for other purposes, especially for debugging.

You can still send a bot with any messages by sendMessage , even if any designers for bots like the same @ Manybot . This is not a hindrance.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions