Learn R Programming

SimDesign (version 2.19.2)

new_TelegramNotifier: Create a Telegram Notifier

Description

Constructs a notifier object for sending messages via Telegram. Requires a valid Telegram bot token and chat ID.

Usage

new_TelegramNotifier(bot_token, chat_id, verbose_issues = FALSE)

Value

An S3 object of class "TelegramNotifier".

Arguments

bot_token

A character string representing your Telegram bot token, typically something like "123456:ABC-xxxx".

chat_id

A character string or numeric representing the chat/group to send messages to.

verbose_issues

Logical. If TRUE, provides detailed information about warnings and errors in the notifications.

Details

To use send notifications over Telegram with httr in SimDesign, install httr, set set up a Telegram bot, and obtain a bot token and chat ID. For more information, see the Telegram Bots API. Then use the new_TelegramNotifier() function to create a TelegramNotifier object and pass it to the notifier argument in runSimulation().

Examples

Run this code
if (FALSE) { # interactive()
# Create a Telegram notifier (requires setting up a Telegram Bot)
telegram_notifier <- new_TelegramNotifier(bot_token = "123456:ABC-xyz", chat_id = "987654321")
}

Run the code above in your browser using DataLab