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. 

...

The ID of the chat channel for the telegram bot, which is provided to you when creating the bot (see www.telegram.org) . Any 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:


Code Block
xmlxml
<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>

...