send.py (view raw)
1from dotenv import load_dotenv
2from os import getenv
3load_dotenv()
4
5## Config start
6endpoint = "sendMessage"
7payload = {
8 "chat_id": getenv("group_id"),
9 "text": "Hello world!",
10
11 "parse_mode": "markdown",
12 "reply_to_message_id": None,
13 "disable_web_page_preview": False,
14 "disable_notification": False,
15}
16## Config end
17
18from requests import post
19response = post(f"https://api.telegram.org/bot{getenv('token')}/{endpoint}", json=payload,
20 headers={ "accept": "application/json", "content-type": "application/json" })
21print(response.text)