import json
import requests


def sendTelegramMessage(
    body: str, apiKey: str, chatId: str, disableNotifications: bool = True
) -> bool:
    """
    Send a Telegram message using the REST api.

    Docs: https://core.telegram.org/bots/api#sendmessage
    """
    headers = {"Content-Type": "application/json"}

    data_dict = {
        "chat_id": chatId,
        "text": body,
        "parse_mode": "HTML",
        "disable_notification": disableNotifications,
    }
    data = json.dumps(data_dict)

    url = f"https://api.telegram.org/bot{apiKey}/sendMessage"
    response = requests.post(url, data=data, headers=headers, timeout=1)
    return response.ok