Learn R Programming

telegram.bot (version 2.2.0)

sendDocument: Send general files

Description

Use this method to send general files.

Usage

sendDocument(chat_id, document, filename = NULL, caption = NULL,
  disable_notification = FALSE, reply_to_message_id = NULL,
  reply_markup = NULL, parse_mode = NULL)

Arguments

chat_id

Unique identifier for the target chat or username of the target channel.

document

File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a local file by passing a file path

filename

(Optional). File name that shows in telegram message.

caption

(Optional). Document caption, 0-1024 characters.

disable_notification

(Optional). Sends the message silently. Users will receive a notification with no sound.

reply_to_message_id

(Optional). If the message is a reply, ID of the original message.

reply_markup

(Optional). A Reply Markup parameter object, it can be either:

parse_mode

(Optional). Send 'Markdown' or 'HTML', if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.

Details

You can also use it's snake_case equivalent send_document.

Examples

Run this code
# NOT RUN {
bot <- Bot(token = bot_token("RTelegramBot"))
chat_id <- user_id("Me")
document_url <- "https://github.com/ebeneditos/telegram.bot/raw/gh-pages/docs/telegram.bot.pdf"

bot$sendDocument(chat_id = chat_id,
                 document = document_url)
# }

Run the code above in your browser using DataLab