Outgoing Webhook In MS Teams

Overview

 
This blog will help you to configure Outgoing Webhook and receive messages sent from MS Teams.

Outgoing Webhook in MS Teams acts like a bot and we can trigger it from channel using @mention and we can send the message to the channels as well using outgoing webhooks.

Note
Outgoing webhook are scoped at the team level.
 

Solution for Outgoing webhook

 
Step 1
 
Clone the repository from the below link for sample purposes:
https://github.com/OfficeDev/microsoft-teams-sample-outgoing-webhook
 
Step 2
 
Open the solution in Visual Studio and run the Solution
 
Step 3
 
Install ngrok from the below link
https://ngrok.com/download
 
Step 4
 
Open command prompt and navigate to the folder where we have stored ngrok.exe:
 
ngrok.exe http 1163 -host-header="localhost:1163"
 
Step 5
 
Copy the forwarding with https URL
 
 
 

Registering Outgoing webhook

 
Step 1
 
Click on More options(…) on Teams
 
Step 2
 
On the fly out menu select "Manage Team"
 
Step 3
 
Select the Apps Tab in Manage Teams section and click on Create an outgoing webhook
 
 
 
Step 4
 
Fill in the form with appropriate data
  • Name :- This name would be used in @mention name
  • Callback URL :- The URL copied from ngrok and appened it with /api/sample
  • Description :- This would be used for describing the outgoing webhook
 
 
Step 5
 
Once we click on create we will get an access token which will be used for authenticating the data.
 
Copy the code and add it in the sample solution AuthProvider.cs file.
 
 
 
Final Outcome