TelegramSendDocumentAsync

A wrapper for the Telegram sendMessage function to send a Document (non-blocking execution).

This function invokes an asynchronous request to the Telegram API. To avoid any blocking of the calling function the execution immediatly returns after the request was executed. It won't wait for the callback. This means you can not ensure that the message was successfully sent. If you need to ensure message delivery, use TelegramSendDocument instead.

Parameter

string apiKey

The Telegram bot API key

string chatId

The Telegram chat ID that will receive the message

string filePath

The path to the file that shall be sent

string caption

The caption for the document

Returns

A string indicating if the request was successfully executed. 0 means there was no failure.

Code Example

Print(TelegramSendDocumentAsync(apikey, chatid, "F:\\testpic.txt", "test document")); // Will print "0" on success

Remarks

  • This function might be helfpul when sending large images or logfiles.