Skip to main content

Microsoft Teams Target

The Teams target posts to a Microsoft Teams channel webhook whenever an automation fires.

IdNameTemplateIcon
odsl.teamsSend a Teams messagesend a Teams message to [url] using [template]microsoft-teams text-teams

The target works with any service and any action. It supports property-change filtering but not @transformer.

Inputs​

InputDescription
urlThe webhook URL of the Teams channel
templateA mustache template for the message
Message formatting

In the current automation handlers, the triggering data is posted to url as JSON and the template input is not applied. The receiving channel gets the raw JSON data, not a formatted message. This target also does not support @transformer. Set template because the target asks for it, but do not rely on it to format the message.


Example: post to Teams when a dataset is late​

a = AutomationBuilder("dataset", "private", "ICE.NDEX.NLB").build()

c = SimpleObject()
c.source = "private"
c.service = "dataset"
c.id = "ICE.NDEX.NLB"
c.action = "late"
conds = []
conds.add(c)
a.conditions = conds

a.target = "odsl.teams"
a.template = "When 'ICE.NDEX.NLB' is late, send a Teams message to [url] using [template]"
a.icon = "microsoft-teams text-teams"
a.properties.url = "https://mycompany.webhook.office.com/webhookb2/your-channel-webhook"
a.properties.template = "dataset-late-message"
a.enabled = true
save ${automation:a}

Fixing the channel URL in a custom target​

For a shared channel, you can create a custom target that wraps the built-in Teams handler (@TeamsChannelTarget) with the url fixed in its properties. Users then pick the target without ever handling the webhook URL. See Custom Targets for how to do this.