Skip to content

Notifications to a person's Teams chat ​

A notification can go straight to a person's Teams chat (Exment 7.2.6 or later). Exment sends it to a Teams workflow (Power Automate), and the workflow posts it to the person's chat as a bot (Flow bot).

  • What is sent: the subject, the body and the link to the data. In Teams it arrives as a card (Adaptive Card): the subject as a bold title, the body with its paragraphs and numbered lists, and an "Open" button
  • The subject and the body of the notification template are used in the language of the person (User language)
  • The Teams account is the person's e-mail address in Exment

The way to post to a channel used until now (Webhook, Microsoft Teams) relies on the Office 365 connectors, which Microsoft is retiring. The same workflow can post to a channel too (see "To a channel" below).

1. Make the workflow in Teams ​

Someone of the Teams organisation makes it (it runs as their account).

  1. In Teams, open Workflows from "Apps", then "Create" → "Create from blank"
  2. As the trigger, choose When a Teams webhook request is received
    • "Who can trigger the flow": Anyone. Exment is accepted only by knowing the address, so keep the address secret
  3. With "New step", add Post card in a chat or channel
    • Post as: Flow bot
    • Post in: Chat with Flow bot
    • Recipient: the expression triggerBody()?['to_email']
    • Adaptive Card: the expression triggerBody()?['card']
  4. Save. The trigger gets an HTTP POST URL: copy it

The JSON Exment sends ​

The workflow receives JSON in this form. The card (card) is made by Exment, so the workflow only posts it as it is.

json
{
  "to_email": "user1@example.com",
  "title": "Issue updated (ISS00423)",
  "body": "**Cannot log in**\n\n1. Status changed to In progress",
  "url": "https://exment.example.com/admin/data/pm_issue/423",
  "sender": "Seiji Noro",
  "locale": "en",
  "card": { "type": "AdaptiveCard", "version": "1.4", "body": [ ... ], "actions": [ ... ] }
}

When you use the "Request Body JSON Schema" of the trigger, put this in.

json
{
  "type": "object",
  "properties": {
    "to_email": { "type": "string" },
    "title": { "type": "string" },
    "body": { "type": "string" },
    "url": { "type": ["string", "null"] },
    "sender": { "type": ["string", "null"] },
    "locale": { "type": "string" },
    "card": { "type": "object" }
  }
}

2. Set it in Exment ​

  1. In "Admin Setting" → "Feature Management", set Teams notifications (personal chat) to "Use" (it is not used at first)
  2. In "System Setting" (Detail Setting), under Teams (workflow), put the copied URL in "New address" and save
    • The address is a secret: after saving it is not shown on the screen again (only "Set (not shown)"). Saving with the field empty keeps the address. To remove it, turn on "Delete the address" and save
    • The address is not written to the operation log either
  3. In a notification (Notification), choose Teams (personal) as the "Notify Action" and choose the targets (user or organization columns, the creator, ...)

To a channel ​

In the workflow, choose Channel for "Post in" and the team and channel (no recipient expression). Give the notification one target in Exment: it is sent once per person, so many targets post the same card many times.

When nothing arrives ​

  • When the log of Exment (storage/logs) says "the Teams workflow answered …", look at the run history of the workflow (Workflows in Teams → the flow → run history) for the reason
  • When the recipient is not found, check that the e-mail address of the Exment user is the Teams account (the organisation address)
  • When nothing happens, check that "Teams notifications (personal chat)" is set to "Use" in Feature Management and that the address is set in the system setting