Our staff is trying to move to using Microsoft Teams for internal communication instead of email. As we are making this move, we wanted to make sure that Rock wasn't contributing to the email overload in everyone's inbox. To help with this, we set up a utility workflow that can make a post into a Teams channel.

Setup

Teams

Before we can post into a channel, we have to generate a webhook for that channel.

  1. Use this link to add the "Incoming Webhook" app to the channel. (This is an official Microsoft app, not a third-party)
  2. Once the connector is installed, you will be asked to provide a Name and Profile Image for the messages posted by the connector. (We chose to be generic here so all things Rock can use the same connector. You could also get specific and add multiple connectors for different areas)
  3. After adding the connector, you will be given a webhook URL. Copy that as we will need it later when sending a message.

Rock

I have created a utility workflow to make posting messages easier.

  1. Download the workflow export that is attached to this recipe.
  2. Navigate to "Admin Tools > Power Tools > Workflow Import/Export" to import the workflow
  3. Take note of the WorkfowTypeId for use later

Using the Workflow

Basic (text-only)

In its most basic form, the workflow will post a text-only message. All that is required for this is passing in the webhook you copied earlier, and the text you want to send.

{% workflowactivate workflowtype:'123' webhook:'YourWebhookHere' text:'Hello world!' %}{% endworkflowactivate %}

Advanced (Templated Card)

Adaptive cards allow you much more flexibility than simple text. You can include formatting, images, and even action buttons that can link back to Rock.

The workflow includes an adaptive card template that we commonly use. You can also design your own custom template and pass that into the workflow to post.

To use the included card template, you can pass in the following parameters. (All parameters are optional unless specified)

  • Title: The title on the card
  • FromPerson: This person's photo and name will show on the card [required]
  • Subtitle: Smaller text under the person's name
  • BodyText: Paragraph text that will display above the facts table
  • Facts: A set of key-value pairs that will show in a table on the card. (key1^value1|key2^value2)
  • Actions: A set of key-value pairs that describe the buttons for the card. (text1^url1|text2^url2)
{% workflowactivate workflowtype:'123' webhook:'YourWebhookHere' title:'Hello world!' fromperson:'{{ CurrentPerson.PrimaryAlias.Guid }}' subtitle:'This is a test' bodytext:'Lorem ipsum dolor sit amit...' facts:'foo^bar|baz^qux' actions:'RockRMS^https://rockrms.com' %}{% endworkflowactivate %}

Custom Adaptive Card

If you want to design your own template, you can use Microsoft's adaptive card designer. The designer provides a WYSIWYG template designer and provides you with the JSON template. To post your custom card, you can call the workflow and pass in the template in the card parameter.

{% capture cardTemplate -%}
 Paste your card template here
{%- endcapture %}
{% workflowactivate workflowtype:'123' webhook:'YourWebhookHere' card:'{{ cardTemplate }}' %}{% endworkflowactivate %}

Change Log

  • 2024-04-25 - Initial Version