Integrate Microsoft Teams with webhooks
Learn to automate Microsoft Teams messages using webhooks in Test Observability.
BrowserStack Test Observability provides custom payload templates to integrate webhooks with Microsoft Teams.
Follow these steps to integrate webhooks with Microsoft Teams:
- Open Settings > Webhooks of your project and click Create webhook.
- Enter a webhook name and select an event type.
- Click Add trigger condition and configure filters from the available options.
- Click Create Microsoft Teams incident.
- By default,
POST
method is selected. You can selectPUT
method if you need to. - Paste your Microsoft Teams webhook endpoint in the URL field. You can also click + to add variables to the URL.
-
Edit the payload body including the variables and key-value pairs according to your specific use case. You can include variables by clicking the Variables menu and selecting any variable. You can refer to the annotations in the following example to know what all you need to update:
{ "@type": "MessageCard", // Specifies the type of card, which is a message card in this case. "@context": "http://schema.org/extensions", // Provides context for interpreting the data structure. "summary": "Build Status: ", // A brief summary of the card, dynamically including the build name. "title": "Build Completed: ", // The title of the message card, dynamically including the build name. "sections": [ // Contains sections to group related information. { "activityTitle": "Build Details", // Title for this section, which contains build details. "facts": [ // Key-value pairs providing detailed information about the build. { "name": "Duration", // Label for the fact. "value": "" // Value dynamically populated with the build duration. }, { "name": "Status", "value": "" // The current status of the build. }, { "name": "Started", "value": "" // Timestamp indicating when the build started. }, { "name": "Finished", "value": "" // Timestamp indicating when the build finished. } ] }, { "activityTitle": "Test Results", // Title for this section, which contains test results. "facts": [ { "name": "Passed", "value": "" // The number of tests that passed. }, { "name": "Failed", "value": "" // The number of tests that failed. }, { "name": "Skipped", "value": "" // The number of tests that were skipped. } ] } ], "potentialAction": [ // Defines actions the recipient can take directly from the card. { "@type": "OpenUri", // Specifies the action type, which is opening a URI. "name": "View Details", // Label for the action button. "targets": [ { "os": "default", // Specifies the default OS for the action. "uri": "" // URL to view detailed build and test results. } ] } ] }
- Select the type of Authorization from the Authorization tab.
- Add optional headers as key-value pairs from the Headers tab.
- Add optional parameters as key-value pairs from the Parameters tab.
- Switch on Re-trigger webhook if the build starts passing if you want to retrigger the webhook when the build passes.
- Click Test Webhook.
- Click Create.
These steps using the built-in template for MS Teams simplifies the integration. However, you can also refer to the original API to create a chat message in MS Teams.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!