Has anyone ever connected to Microsoft Teams from ...
# general
t
Has anyone ever connected to Microsoft Teams from NetSuite, like to send alerts? My goal is to send an alert to a teams channel when a saved search returns results.
e
I did something similar to this a few weeks ago. I'll share some code below.
Copy code
const payload = {
        "type": "message",
        "attachments": [
            {
            "contentType": "application/vnd.microsoft.card.adaptive",
            "contentUrl": null,
            "content": {
                "$schema": "<http://adaptivecards.io/schemas/adaptive-card.json>",
                "type": "AdaptiveCard",
                "version": "1.2",
                "body": bodyMessages,
                "msteams": { "width": "full" }
            }
        }
        ]
    };
    const result = <http://https.post|https.post>({
        url: executionVars.teams_webhook_url,
        body: JSON.stringify(payload)
    });
You'll need to build a payload in the format of an AdaptiveCard type. https://adaptivecards.io/explorer/
You'll send that payload to a Webhook that you set up on the Teams channel you'd like to post to. There are limitations to what you can do. For example, you cannot update an existing message. If you wanted to do more, you'd probably need to build a Teams Bot app. But, it sounds like the webhook option might work for your use-case.
t
Thanks, I will take a look at this.
m
You could also try to setup the search to email results on a schedule or on create/update. Then use the email to channel feature in teams to capture the email as a message in the channel https://support.microsoft.com/en-us/office/tip-send-email-to-a-channel-2c17dbae-acdf-4209-a761-b463bdaaa4ca