Microsoft Teams Webhook: Easy way to get real-time notifications from applications
Introduction:
Nowadays demand for applications from small to large businesses into the market is increasing. Every business is coming online to improve efficiency and to improve the relationship with their customers. Here, the most important factor is the real-time updates of your business to your customers. You can achieve this by using Microsoft Teams Incoming Webhook.
What is Microsoft Teams Webhook?
Webhooks help to connect the web services to channels and teams in Microsoft Teams. Webhooks are user-defined HTTP callback that notifies users about any action that has taken place in the Microsoft Teams channel. It is a way for an app to get real-time data.
Types of Microsoft Teams Webhook?
- Incoming Webhook
This allows any external application to send proactive messages to the team’s channel. We can use this webhook as a notification or tracking tool.
- Outgoing Webhook
Webhooks help Teams to integrate with external apps. With Outgoing Webhooks, you can send text messages from a channel to the web services. After configuring the Outgoing Webhooks, users can @mention Outgoing Webhook and send a message to web services. The service responds within ten seconds to the message with a text or a card.
In this blog, we will check how to use Incoming webhook to send real-time messages to the team channel.
Steps to Configure Incoming Webhook:
- Click on the team’s channel in which you want to add the incoming webhook. You will get the below options by clicking on the ellipses in the top navigation bar. Select Connectors from the drop-down menu.
- In the connector window search for Incoming Webhook if you are not able to see in the panel and then click on Configure button.
- Provide a name, and upload an image for your Webhook if required. Then click on Create button.
- Next, a dialog box will appear proffering a unique URL that maps to the Microsoft Teams Channel. Save this Webhook URL for future uses. Select Done to finish the process.
- Now we have successfully configured the connector in the channel. You should see something like below.
Test Incoming Webhook:
Option 1: Using Powershell
Now it’s time to test this incoming webhook by sending the notifications to the team channel. You can do this by sending a message using HTTP POST operation through powershell.
Use below syntax and replace the URI.
Invoke-RestMethod -Method post -ContentType ’Application/Json’ -Body '{“text”:”Hello World!”}’ -Uri <URL of the webhook you copied>
Open the teams and you can see the message. Voila!
Option 2: Using a python script
Also, test the webhook by sending a message from the python script.
You can change the data variable which is in JSON format and customized message or notification.
You will get the notification like below.
Hope you find this blog informative!
References:
Add Comment
You must be logged in to post a comment.