TelegramSendScreen

A wrapper for the Telegram sendMessage function to send a screenshot of all displays (blocking execution).

This function invokes an asynchronous request to the Telegram API. To ensure successful sending of the message this function waits for the callback. If you need to return back to the caller function quickly use TelegramSendScreenAsync instead.

Parameter

string apiKey

The Telegram bot API key

string chatId

The Telegram chat ID that will receive the message

string caption

The caption for the screenshot

Returns

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

Code Example

Print(TelegramSendScreen(apikey, chatid, "test photo")); // Will print "0" on success

Remarks

  • This function is especially useful if you have a single screen with Metatrader as active window. Use TelegramSendPhoto[Async] or TelegramSendDocument[Async] in conjunction with MQL native functions like chartscreenshot instead if you need to send file based pictures or chart screenshots.
  • The same is valid if your pictures exceed a maximum resolution/size. Telegram will then shrink the size of your screenshots.