Telegram `setTyping` API call

Viewed 1858

I'm trying to set my bot's typing status by sending the following POST request (based on the API docs):

https://api.telegram.org/bot{{botToken}}/setTyping

{
  peer: {{chat_id}},
  typing: true,
  action: 'sendMessageTypingAction'
}

I've tried a few variations of it, such as changing the url to be /messages.setTyping and sending the action as {"_":"sendMessageTypingAction"} as seen here, but all I get is:

{
    "ok": false,
    "error_code": 404,
    "description": "Not Found: method not found"
}

Anyone know what I'm doing wrong?

2 Answers

Thanks to @tashakori for pointing me in the right direction towards the Bot API. For posterity, what I needed to do was:

https://api.telegram.org/bot{{botToken}}/sendChatAction

{
  chat_id: {{chatId}},
  action: 'typing'
}

The link you have mentioned above belongs to Telegram Core APIs which is used for handling ordinary accounts of Telegram. These so-called Core APIs are not related to Telegram Bot APIs.

The only API that is somehow similar to SetTyping for bots is AnswerCallbackQuery, which can be used only when responding to the user's interaction with inline keyboards. (you can send a text to the user, saying that there is a process running in the background and whenever the user's answer is ready, you can send it using APIs like sendMessage)

Related