Qlik Community

Knowledge

Search or browse our knowledge base to find answers to your questions ranging from account questions to troubleshooting error messages. The content is curated and updated by our global Support team

Announcements
Support Case Portal has moved to Qlik Community! Read the FAQs to start exploring Support resources.

How-to: Getting started with Microsoft Teams in Qlik Application Automation

MarkGeurtsen
Support
Support

How-to: Getting started with Microsoft Teams in Qlik Application Automation

Authentication and Authorization

The Microsoft Teams connector in Qlik Application Automation is making use of oAuth to ask users to give Qlik Application Automation access to Microsoft Teams. When creating your datasource, you will be prompted with a screen whether you want default permissions or admin permissions. The difference is the scopes that are requested by Qlik Application Automation. Default permissions request the following scopes:

  • User.Read
  • profile
  • openid
  • Team.ReadBasic.All
  • email
  • offline_access
  • ChatMessage.Send
  • ChatMessage.Read
  • ChannelMessage.Send
  • ChannelMessage.Edit
  • ChannelMessage.Delete
  • Channel.ReadBasic.All

In a default setup of an Office 365 tenant, regular users can make use of all of these scopes. If you cannot login using the default permissions you will have to contact your Office 365 admin regarding the use of this connector.

When selecting the admin permissions, the following scopes will also be requested and these will require admin consent to being used:

  • ChannelMessage.Read.All
  • Group.ReadWrite.All
  • Channel.Delete.All

Some blocks inside Qlik Application Automation require these admin permissions when being used. For example the blocks "List All Teams" and "Delete Team Channel". In the description of certain blocks it will tell you that you require admin permissions before being used.

Sending messages from Teams

The following blocks can be used to send a Message to a MS Teams channel:

  • Send Message
  • Send Html message
  • Send Html Message With Base64 Image
  • Send Structured Message With Base64 Images

Sending messages

In the block Send Message, you can optionally add one or more attachments. Attachments are typically Cards, see below for more information.


Sending HTML messages

The following commands can be used to sent HTML messages to a MS Teams channel.

Block Send Html Message With Base64 Image
This block allows the user to send a message with HTML content and one base64 image. You can optionally add HTML code before and/or after the image. It's possible to encapsulate the image in HTML elements by opening an HTML tag in the Html Before Image input and closing the tag in the Html After Image input.

 

Block Send Structured Message With Base64 Images

This block allows the user to add one title, two paragraphs of text, two base64 images and two buttons with an action URL. You can choose which content items to use and you can define the order of these items in the message.

Sending Cards

Cards can contain text, images and buttons. They are added as Attachments to a message. More information about the different types of cards can be found here: Cards
The block Send Message can be used to send Cards to an MS Teams channel. The Card needs to be created with one of the following blocks:

  • Create Attachment Hero Card
  • Create Attachment Thumbnail Card
  • Create Attachment Adaptive Card

The output of the Snippet block needs to be mapped to the Attachment field of the Send Message block.
The Attachment also needs to be added as an HTML tag inside the Content. Example:

 

<attachmentid="{$.CreateAttachmentHeroCard.id}"></attachment>

 

If you omit this HTML tag, it will be automatically appended by Qlik Application Automation at the end of your Content.
You can also add multiple attachments in one message, by creating a variable of type list (e.g. myAttachments), adding individual Attachments to this list and using the list variable in the Attachment field of the block Send Message.

Snippet block Create Attachment Adaptive Card

This block accepts a raw JSON representation of the Card as input. An interactive interface to generate the correct JSON of the Card can be found here: Card JSON
Note: it's possible to include base64 strings of small images as value for the url parameter. Keep in mind that MS Teams will not throw an error if the base64 string is too large, it will simply create a Card without the image. To create cards with large images, a public URL to the image should be used.

How to send images to MS Teams

Images with a public URL
You can use an HTML img tag with a public URL to the image in following blocks:

  • Send Message
  • Send HTML Message

Example:

<img src="https://picsum.photos/200.jpg">

You can use an image with a public URL in Cards using following blocks:

  • Block Send Message + Snippet Create Attachment Hero Card
  • Block Send Message + Snippet Create Attachment Thumbnail Card
  • Block Send Message + Snippet Create Attachment Adaptive Card

Images with a non-public URL

If your image has a non-public URL, you can store it on cloud storage first (e.g Dropbox or S3), retrieve a public (shareable) URL from the cloud storage provided, and use that public URL in MS Teams.

Base64 images

With Base64 images we always recommend obtaining them from an external source and reference the variable in which the base64 string is stored, rather than attempting to paste a base64 string in an input field. This due to performance reasons.
You can send an image as a base64 encoded string using following blocks:

  • Send Html Message With Base64 Image
  • Send Structured Message With Base64 Images
  • Block Send Message + Snippet Create Attachment Adaptive Card

MS Teams Cards (see above) only support very small base64 images, e.g. icons. To send large images in base64 format, use one of the following blocks which use HTML to render the message:

  • Send Html Message With Base64 Image
  • Send Structured Message With Base64 Images

The information in this article is provided as-is and to be used at own discretion. Depending on tool(s) used, customization(s), and/or other factors ongoing support on the solution below may not be provided by Qlik Support.

Tags (2)
Labels (1)
Version history
Revision #:
2 of 2
Last update:
‎2021-09-22 09:24 AM
Updated by:
 
Contributors