Important Note: Microsoft has announced the retirement of Office 365 connectors within Microsoft Teams. The webhook type discussed in this article is one of the connectors being retired. As of 7/23/2024, Microsoft has announced that these connectors will be active through 12/2025, after which they will be fully retired. Additionally, for users who want to continue to use these webhooks beyond 12/31/2024, configuration changes are required. See the Microsoft announcement article for full details. Note that Microsoft's plans are evolving; consult the Microsoft article periodically to stay updated.
Important Note: Microsoft offers Power Automate workflows, which includes webhooks that can be used in place of the Office 365 connectors webhooks. QuerySurge plans to offer support for these webhooks in an upcoming release.
Teams Webhooks
QuerySurge has long emphasized team communication and information-sharing in its design. As part of that emphasis, webhook support has been introduced in QuerySurge 10.0. This article describes the basic setup for Microsoft Teams webhooks, part of the Office 365 connectors Teams feature.
QuerySurge installs with four prebuilt sample Teams webhooks, which you can use as-is, or modify for your needs:
Update: Scenario Started
Update: Scenario Ended
Results: Scenario Execution
Results: Scenario Summary
This article describes the webhook setup for the Teams Update: Scenario Started webhook.
Prerequisite: Create the Webhook
Many webhook products require some amount of setup in order for QuerySurge (or any other external system) to send in webhook messages. In Teams, the Incoming Webhook feature needs to be enabled. During the setup process, a unique URL is generated for your incoming webhook, which you'll need in order to setup your webhook in QuerySurge. For details, you'll need to consult the product documentations (for Teams, start with this article).
A Sample Teams Webhook
Lets review the setup for the Update: Scenario Started webhook. This is the simplest webhook message that you can send to Teams; as the name implies, this example announces on Teams that a Scenario execution has started.
- Edit the webhook name if you so choose
- Notice that the "Scenario Started" event has been pre-selected.
- Add an optional Description (as needed).
- The Request Method of POST is almost invariably the method for any webhook (QuerySurge does support a PUT option).
- The webhook Provider is Teams.
- The Endpoint URL must be entered - you'll get it from Teams when you set up your (incoming) webhook in Teams.
- No special HTTP Headers are required for Teams webhooks (however other webhooks may have header requirements). There is a default Content-Type header that is generally required for any webhook.
- The Webhook payload, as noted, is a very simple JSON (which follows the Teams JSON syntax):
{
Notice there are two fields in this example denoted by dollar-signs and curly braces: ${Scenario Name} and ${Start Time}. This notation is QuerySurge-specific, and gives you access to QuerySurge values in your webhooks messages. You can see the fields that are available by clicking on the icon at the upper right of the payload. The fields available are dependent on the QuerySurge event (a different set is available for each event) you have selected. When you choose a field off the list, it will automatically be entered into your JSON at the current insertion point.
"title": "Scenario Started",
"text": "${Scenario Name}\n\n[${Start Time}]"
}
- You have the option to add additional filters on an event. For example, you could limit the firing of the webhook to a specific owner (i.e. user), or in the "Scenario Ended" event, to whether the execution passed or failed.
- Teams webhooks don't rely any authentication (beyond the extended URL).
- At the bottom right, there is a Save button with an arrow at its right. When you click on the arrow, a popup Test Webhook button shows, which allows you to test your webhook setup with dummy data. Error messages are reported along the bottom of the window. Once your setup is working, use the Save button to save your webhook.
- The Webhook message appears in Teams when your Scenario starts execution:
Comments
0 comments
Article is closed for comments.