# Links
[Available Methods](https://core.telegram.org/bots/api#available-methods)

# Send message
1) Open https://telegram.me/botfather and create bot
2) Get messages from your bot: https://api.telegram.org/bot<Bot_token>/getUpdates
3) Get chat id from response result.$.message.chat.id
4) Send message to bot: https://api.telegram.org/bot<Bot_token>/sendMessage?chat_id=<chat_id>&text=hello

Message with buttons:
```
https://api.telegram.org/bot<Bot_token>/sendMessage?chat_id=-<chat_id>&text=hello&reply_markup={"inline_keyboard":[[{"text":"button","url":"https://pravyysektor.info"}]]}
```

# Get bot info
https://api.telegram.org/<Bot_token>/getMe

# Отримання chat_id

## Для групи

Ідемо в веб-версію і переходимо в групу. Отримуємо урл <nowiki>https://web.telegram.org/#/im?p=g{chat_id}.

Chat_id = -{chat_id}

## Для канала

Ідемо в веб-версію і переходимо в групу. Отримуємо урл <nowiki>https://web.telegram.org/#/im?p=c{chat_id}_1111111111111.

Chat_id = -100{chat_id}

## Для приватного чата з ботом

* Стартуємо чат з ботом, пишемо йому повідомлення. 
* Отримуємо повідомлення https://api.telegram.org/bot<Bot_token>/getUpdates
* Шукаємо в відповіді сервера повідомлення, яке ми надіслали, і звідтри отримуємо char_id = result.$.message.chat.id

# Posting from bot to chat
* Add bot to chat as administrator