Teams channel notification template using Webhook

I am trying to add the Microsoft Teams integration, but the integration documentation is terrible and I can’t understand it past the configuration.yaml part. If anyone can help me, that would be great.

My goal is to automate that if a temperature sensor reads above temperature x then send a teams notification with the name of the temperature sensor and the temperature reading.

Did you consider the possibility you just didn’t understand it?

Did you, well, add the Incoming Webhook app to your team channel?

image

Yes, I’m aware that I don’t understand it, I got the webhook link and I added it in the configuration.yaml in the given format however, I didn’t understand what to do after that.

Edit: I got it working, I didn’t realize the rest was for the scripting of it.

How did you get it fixed? I’ve been trying to figure this out as well.

I just answered my own question finally.

Answer:

This goes into your configuration.yml

notify:
  - platform: msteams
    url: https://outlook.office.com/webhook/<ID>

When referencing this in an automation, you need to put notify.notify and not notify.msteams as I had put:

action:
  - service: notify.notify
    data:
      message: Some sort of message.
      title: A fancy title

Suggestion for documentation:

It was confusing because it wasn’t clear what was referencing the ‘notify’ service, and the particular implementation of the msteams webhook . Better documentation would have been to give a complete exaple in the configuration.yml and automation.yml. I see this throughout the documentation, which over time you figure out but hard to onboard new people.

Can I append a question here?

How could I potentially add multiple different web hooks for different channels?

If I remember correctly notify.notify sends notifications to all notifiers. If you want to send a notification to msteams alone, name your notifier in the configuration.yaml.

I guess by doing something like this

1 Like