# How to write the script of alarm notification to show in channel of microsoft teams?

**URL:** <https://forum.inductiveautomation.com/t/how-to-write-the-script-of-alarm-notification-to-show-in-channel-of-microsoft-teams/50507>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [September 1, 2021, 9:58am UTC](https://forum.inductiveautomation.com/t/how-to-write-the-script-of-alarm-notification-to-show-in-channel-of-microsoft-teams/50507 "2021-09-01T09:58:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![apiraksr](https://avatars.discourse-cdn.com/v4/letter/a/f9ae1b/32.png) [@apiraksr](https://forum.inductiveautomation.com/u/apiraksr)\
**Post date:** [September 1, 2021, 9:58am UTC](https://forum.inductiveautomation.com/t/how-to-write-the-script-of-alarm-notification-to-show-in-channel-of-microsoft-teams/50507/1 "2021-09-01T09:58:00Z")

</div>

I would like to use alarm notification. Could you share script for me,please?

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [September 1, 2021, 1:49pm UTC](https://forum.inductiveautomation.com/t/how-to-write-the-script-of-alarm-notification-to-show-in-channel-of-microsoft-teams/50507/2 "2021-09-01T13:49:08Z")

</div>

I’m not sure you can send notifications to teams directly from the alarm/pipeline configuration…  
But you can send a notification email or text message, and then I’m sure there are ways of forwarding those to a teams channel.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [September 1, 2021, 2:07pm UTC](https://forum.inductiveautomation.com/t/how-to-write-the-script-of-alarm-notification-to-show-in-channel-of-microsoft-teams/50507/3 "2021-09-01T14:07:42Z")

</div>

team groups have an email address.  
i blurred mine out but its where the arrow points too xd

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/b/fbaf7b1cff7d964b146f35fb84462672b7ac92be.png)

---

<div class="post-metadata">

**Author:** ![apiraksr](https://avatars.discourse-cdn.com/v4/letter/a/f9ae1b/32.png) [@apiraksr](https://forum.inductiveautomation.com/u/apiraksr)\
**Post date:** [September 1, 2021, 3:00pm UTC](https://forum.inductiveautomation.com/t/how-to-write-the-script-of-alarm-notification-to-show-in-channel-of-microsoft-teams/50507/4 "2021-09-01T15:00:08Z")

</div>

Thank you very much.

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [September 1, 2021, 6:16pm UTC](https://forum.inductiveautomation.com/t/how-to-write-the-script-of-alarm-notification-to-show-in-channel-of-microsoft-teams/50507/5 "2021-09-01T18:16:14Z")

</div>

I didnt completely test this out, but this should roughly get you on the right path.

EDIT: Replaced this with a version that I just tested and posted to a teams chat!

```auto
def msTeams(val):
    import system
   
    url = "https://outlook.office.com/webhook/" \
           "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx@xxxxxx-xxx-xxx-xxx-xxxxx/" \
           "IncomingWebhook/xxxxxxxxxxxxxxxx/" \
           "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
    contentType = "application/json"
   
    brutData = {
        "@type": "MessageCard",
        "@context": "http://schema.org/extensions",
        "themeColor": "0076D7",
        "summary": "Ignition Notification Message",
        "sections": [{
                    "activityTitle": "Ignition Notification Message",
                    "activitySubtitle": "Ignition Web Service",
                    "activityImage": "https://avatars0.githubusercontent.com/u/26392698?s=400&v=4",
                    "facts": [{
                        "name": "Message",
                        "value": val},
                        {"name": "Date",
                        "value": system.date.now()
                        },
                    ]
                }]
            }
   
    postData = system.util.jsonEncode(brutData)
    result = system.net.httpPost(url, contentType, postData)
    return result

```

---

<div class="post-metadata">

**Author:** ![gregsachs](https://avatars.discourse-cdn.com/v4/letter/g/58f4c7/32.png) [@gregsachs](https://forum.inductiveautomation.com/u/gregsachs)\
**Post date:** [September 27, 2021, 3:14pm UTC](https://forum.inductiveautomation.com/t/how-to-write-the-script-of-alarm-notification-to-show-in-channel-of-microsoft-teams/50507/6 "2021-09-27T15:14:18Z")

</div>

Apologies if I’m being obtuse, but where does one find the values that fill in the three XXX strings?  
url = “[https://outlook.office.com/webhook/](https://outlook.office.com/webhook/)”   
“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx@xxxxxx-xxx-xxx-xxx-xxxxx/”   
“IncomingWebhook/xxxxxxxxxxxxxxxx/”   
“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx”

Thanks!

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [March 16, 2022, 6:02pm UTC](https://forum.inductiveautomation.com/t/how-to-write-the-script-of-alarm-notification-to-show-in-channel-of-microsoft-teams/50507/7 "2022-03-16T18:02:03Z")

</div>

To get those values you need to create a web hook on the teams channel

This document explains how, I can’t do it in my teams org to show you, but this is fairly comprehensive

> **[Create an Incoming Webhook - Teams](https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook)**
>
> Add Incoming Webhook to Teams app and post any external requests to Teams using it

---

<div class="post-metadata">

**Author:** ![Anant\_Upadhyayula](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@Anant\_Upadhyayula](https://forum.inductiveautomation.com/u/Anant_Upadhyayula)\
**Post date:** [July 30, 2026, 12:36pm UTC](https://forum.inductiveautomation.com/t/how-to-write-the-script-of-alarm-notification-to-show-in-channel-of-microsoft-teams/50507/8 "2026-07-30T12:36:20Z")

</div>

such simple solution, love it.
