Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In addition to the export of reports from the database to a web server, the Report Export module can also 'export' reports (in image format) to Telegram (www.telegram.org) , a a mobile messaging application. For this purpose, the html pages in the report first need to be converted to an image format (i.e. jpeg, png) before they can be published to a "bot channel" on Telegram.

...

Include this optional element with a value indicating the image format (i.e. png, jpg) to cause each html page in the report to be converted to an image of specified format.

N.B. This option works similar to the same as the <generateImage> element in the Report Module configuration. An external conversion program (default is wkthtmltoimage) needs to be configured using the global property REPORT_HTML2IMG_PROGRAM defined in the global properties file.

...

Root element for defining the (encrypted) access token and channel ID that are required to publish messages to Telegram (www.telegram.org)  as as well as a list of image files to publish from the report. 

...

N.B. you can only publish pages from a forecast report to Telegram, there is no option for exporting page from a system status report.


telegramBotToken

The Telegrqam Telegram bot access token, which allows anyone to control a Telegram bot and related channel. Please be aware that anyone with access to this token can control the used bot. In order to encrypt your token you first put the unencrypted token in the report export xml configuration file, then you start up FEWS explorer using the relevant configuration. FEWS will now generate an error message in the log stating that you cannot use the token in this unencrypted form, providing the encrypted token string in the log message. Then you copy paste this encoded version of the token in the configuration xml file.

...

The ID of the chat channel for the telegram bot, which is provided to you when creating the bot (see www.telegram.org) . Any telegram Any Telegram user can subscribe to this channel to receive the photo messages send to this channel by FEWS.

...

Example report export configuration, which exports the last current forecast report, generating an image for each html page, and sends three specific locations to a telegram channel:


xml
Code Block
xml
<reportExport ...>
	<reportExportRootDir>$REPORT_EXPORT_ROOT_DIR$</reportExportRootDir>
	<reportExportTelegramPhoto>
		<telegramBotToken>NNdDxIKKEe0ioFhF/v9V3coUf/fFG94HgP+16hvYQsJfdSR/s3JJx+9MzMoLA82S</telegramBotToken>
		<telegramChatId>-1001345024100</telegramChatId>
		<telegramSendPhoto>
			<reportTelegramFile>Telegram_Inhambane_2.jpeg</reportTelegramFile>
			<reportTelegramCaption>Inhambane, Morungulo (Massinga)</reportTelegramCaption>
		</telegramSendPhoto>
		<telegramSendPhoto>
			<reportTelegramFile>Telegram_Inhambane_5.jpeg</reportTelegramFile>
			<reportTelegramCaption>Inhambane, Zavora (Inharrime)</reportTelegramCaption>
		</telegramSendPhoto>
		<telegramSendPhoto>
			<reportTelegramFile>Telegram_Pemba_1.jpeg</reportTelegramFile>
			<reportTelegramCaption>Pemba, 'offshore' </reportTelegramCaption>
		</telegramSendPhoto>
	</reportExportTelegramPhoto>
	<currentForecastReports>
		<currentForcastSubDir>ForeCast</currentForcastSubDir>
		<numberCurrentForecasts>1</numberCurrentForecasts>
		<includeModuleInstanceId>Report_Telegram_Create</includeModuleInstanceId>
		<generatePdf>true</generatePdf> 
		<generateImage>jpeg<<generateImage>
          <format>png</format>
          <options>--width 720</options>
        </generateImage>
	</currentForecastReports>
</reportExport>



Image Added