# Workato actions for MS Teams

Workbot actions allow you to post messages & replies to users or channels as Workbot.

Additionally, Workbot also includes custom actions. This action allows you to utilize Microsoft Graph APIs (v1.0) (opens new window).

Workbot supports 6 actions:

# Post reply and Post simple reply

The Post reply actions allow you to post a message back to a user when a Workbot command is invoked. Replies are posted directly to the user or in-channel, depending on where the command was invoked.

Post reply Example of a post reply listing open opportunities from Salesforce

This reply can be a simple text message about a task's completion, or more advanced like prompting users on subsequent actions.

You can optionally include 1 fact set (a set of name-value pairs), 1 picklist, buttons, and images.

WARNING

Post reply must always be paired with a Workbot command.

Post reply recipe Recipe perspective of the post reply example above

# Post message and Post simple message

The post message actions allow you to post a message to a user or a channel. It is similar to Post reply, but with an additional field called Message recipient. This field allows you to specify where to post the message (direct to the user, or channel).

Use post message if you:

  1. Are using Workbot to post event notifications from another application, for example, New/updated incident in ServiceNow. Since the trigger is not a Workbot command, Post message must be used so you can specify the 'Message recipient' for the event.

  2. Want control over where Workbot should post the message, instead of sending it where the Workbot command was invoked (which is what Post reply does automatically)

  3. Want to use advanced features like updating a previous message.

# Message recipient

Message recipient allows you to post a message directly to a user or to a channel you specify. To dynamically assign message recipients at runtime, toggle to custom value and use the ID datapill (under Conversation) from the output of a Workbot command (if the recipe uses a bot command).

For all other triggers, use the ID datapill from the output of a preceding Get user info by User Principal Name action.

Post message with conversation ID Posting a message with the conversation ID datapill obtained from the output of a command

Post message with user ID Posting a message with the user ID datapill obtained from the output of a preceding get user info action

To pick from a list of channels instead, toggle to "Select from list".

Post message to channel Selecting a channel to post to

# Messages

Post reply fields Post reply & Post message follow the same message structure

Both post reply and post message actions follow a fixed structure. Text input fields support markdown syntax.

The table below lists the input fields in the post reply action.

Input Description
Message Build a rich, interactive message using Adaptive Card blocks. View the list of supported blocks.
Message to update Use message ID from the output of a post reply or post message action to update that message with this one.

# Mentions

You can mention multiple users in your bot message. To mention users, add them in the mentions section, then reference them in the message itself. Mentions work on the Post message and Post reply actions only.

Mentions example DevOpsBot mentioning 2 users in MS Teams

Follow the detailed steps below to mention users.

No. Step Description
1 Add users to mention in the Mentions section Add the users you want to mention in your message. By default, you can add users 1-by-1. To add a dynamic list of users, switch the input mode to Dynamic list by clicking on the horizontal ellipsis.
2 Enter the user IDs of the users to mention You can obtain user ID pills from the New command trigger and/or a Get user by User Principal Name action. Alternatively, you can key them in manually.

3 Enter display name of the user to mention Enter the desired display name without wrapping with <at></at>. The display name serves as a reference for users mentioned in the message itself.

  1. The text fields in your message are scanned for exact matches to this reference display name (including case). For example, the same user can be mentioned multiple times throughout a message if the display name is found in multiple places.
  2. It formats the display name (found in the text fields) into a mention (purple text).

4 Reference users by their exact display name in the message itself To reference users in the text fields of the message, wrap their display name with <at></at>, for example, <at>@Jan Donyada</at>. The wrapped display name must exactly match the display name used in the Mentions section.

# Post as raw JSON

This field is for advanced users who want to fully customize the message formatting. When set to Yes, all other fields will be hidden. Should include "type": "message", followed by "attachments", for example,

{
    "type": "message",
    "attachments": [
        {
            "contentType": "application/vnd.microsoft.card.adaptive",
            "content": {
                "type": "AdaptiveCard",
                "version": "1.0",
                "body": [
                    {
                        "type": "TextBlock",
                        "text": "Hello World!",
                        "size": "large"
                    }
                ]
            }
        }
    ]
}

For more details, refer to Microsoft's Adaptive Card Designer (opens new window).

# Message to update

Message to update allows you to overwrite a previously posted message from an earlier action step. Simply use the Original message ID datapill (from the output of a Workbot command), or the ID datapill (from the output of a Post message or Post reply action).

Original message ID Original message ID

Message to update example Message to update

# Get user info by User Principal Name

This action allows you to retrieve user info by using a user's User Principal Name (opens new window). The User Principal Name (opens new window) is the login name of the user.

# Input fields

Input field Description
User Principal Name The User Principal Name is the login name of the user.

# Output fields

Output field Description
ID User ID. Can be used in the Message recipient field of a Post message or Post simple message action.
User Principal Name Login name of user.
Surname The user's surname (family name or last name).
Preferred language Preferred language of user. Follows ISO 639-1 Code; for example, "en-US".
Office location The office location in the user's place of business.
Mobile phone The primary cellular telephone number for the user.
Mail The SMTP address for the user, for example "jeff@contoso.onmicrosoft.com".
Job title The user's job title.
Given name The given (first name) of the user.
Display name The name displayed in the address book for the user. This is usually the combination of the user's first name, middle initial and last name.
Business phones The telephone numbers for the user.

# Using dynamic lists in action fields

Fact sets, pick lists, and buttons can be generated dynamically using a list datapill (for more information on lists, see the list management guide)

From the fields, select the horizontal ellipsis on the top-right and choose 'Dynamic list'. This should bring up the dynamic list option.

Dynamic buttons

The following table shows what goes into the dynamic buttons fields:

Input field Description
Buttons source list List datapills have a list icon next to them in the datatree, for example, Salesforce users:
Button text The title of the button to be displayed. Typically, you want to use datapills from the list datapill, for example, Salesforce user name, a datapill from the Salesforce users list:
Submit button command Choose from a list of existing Workbot command recipes or key in a new command. Clicking on this button will trigger the recipe with the corresponding command trigger.
Additional parameters Key in name-value pairs to pass onto the next recipe as additional parameters. Format should be JSON with name-value pairs, for example,

{
"opportunity_id": "Opportunity ID",
"stage": "Stage"
}
Datapills need to be wrapped in double quotes and parameter names must be in all lowercase. Parameters can be user-specified, like the urgency of an issue in ServiceNow, or recipe information, like the Message ID of a previous MS Teams message.

# Show tab using Adaptive Cards

In response to a Tab opened trigger event, you can show a tab using an array of Adaptive Cards. To learn more about how tabs work, see Tabs.

Tab example

# Learn more