Ошибка A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: chat not found
КОД
import time
from datetime import datetime
import httpx
def send_message(chat_id, message):
headers = {
'Content-Type': 'application/json',
'Telegram-Bot-Api-Version': '2022-06-29',
}
data = {
'chat_id': chat_id,
'text': message
}
response = httpx.post(
'https://api.telegram.org/botТ********/sendMessage',
headers=headers,
json=data
)
return response
def main():
token = '65****'
chat_id = -100****
message = 'Текст '
result = send_message(chat_id, message)
print(result.status_code)
if __name__ == '__main__':
main()