Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
This block is meant to provide users with a lot of flexibility in how they want to craft messages posted to teams.
However, this amount of flexibility comes at a cost with regards to user experience.
The following page on the Microsoft Graph API documentation explains how inline images work on the REST API: https://docs.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http#example-5-...
In this block, we have the following input parameters that can be used:
image_1_width: The width of the first image in pixels. Default value is 300.
image_1_heigth: The height of the first image in pixels. Default value is 300.
image_1_content_type: The content type of the image. For example: image/png. This parameter must be provided if the image_1 parameter is part of the item_ordering string.
image_1_base64: an image as a base64 encoded string. It is not recommended to put large strings in here because the frontend will be loading for a very long time.
paragraph_2, image_2_width, image_2_height, image_2_content_type, image_2_base64, button_2_label, button_2_url: identical to the elements mentioned before.
How to encode your image as base64
There are various webtools available that will allow you to upload an image and obtain a base64 string of the file contents.
Alternatively this can be done on a linux using base64 -w 0 <filename>. Or it would be possible to do it in any other programming language.
It's definitely easiest doing this in a browser on any webtool though.
Soon we will have blocks that allow you to open a file and get the file back as Base64 encoded. This article will be updated when this becomes possible.
How to provide item ordering
The item_ordering parameter provides the order in which the elements appear in the constructed message. Items that are not listed will not be part of the message.
The order title, paragraph_1, image_1, paragraph_2, image_2, button_1, button_2 is used when no value is provided.
When providing image_1 and/or image_2, it becomes mandatory to provide the image_content_types as well. Not providing these will cause the block to fail.
An example message
For this message a simple 20x20 image containing a red box was encoded into Base64 format with the following result:
iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAAeSURBVDhPY3gro0I2GtVMIhrVTCIa1UwiGnmaZVQAKzLWYLcYEB8AAAAASUVORK5CYII= |
The following configuration was used for sending a message:
This results in the following message being posted to a Teams channel:
If we were to change the item_ordering to button_1, title, paragraph_1, image_1 the following would be the result:
Conclusion
The "send structured message with base 64 images" block enables end users to create rich messages that can be send to Teams channels. Limitations are that it is limited to two images in a single message. Also images have an upper limit in size that can be uploaded through Base64 in Qlik Application Automation. Items ordering can be used to determine in what order elements should appear in the message.
Good stuff Mark!