# NOT RUN {
updater <- Updater(token = "TOKEN")
# In case you want to set a proxy (see ?httr:use_proxy)
updater <- Updater(token = "TOKEN",
request_config = httr::use_proxy(...))
# Add a handler
start <- function(bot, update){
bot$sendMessage(chat_id = update$message$chat_id,
text = sprintf("Hello %s!",
update$message$from$first_name))
}
updater <- updater + CommandHandler("start", start)
# Start polling
updater$start_polling(verbose = TRUE) # Send '/start' to the bot
# }
Run the code above in your browser using DataLab