Send issue to MS Teams channel
Step 1. Setup Authentication in MS Teams
Goto https://portal.azure.com/ and login
Click on App registrations
Click on view API Permission
Add the scope needed, we added these
Click Enterprise applications in the buttom
Click the big blue button: Grant admin consent
Click on Authentications menu.
Click Add a redirect. Add the url to iHub as stated in the OAuth credential page.
Click on Overview and click on the Endpoints this will display all endpoints needed for your instance
Go to Certificates & secrets and click on new Client secret to generate the client secret, copy this it will only be shown one time.
Step 2. Setup Authentication in iHub
Click on Credentials
Select Oauth2 and enter a name, click add
Fill inte form:
Set up an action to send data to MS Teams channel
Click on integrations
Click New → Action and create.
Select POST as method
Add URL to your channel. See Find the Team Id and Channel Id below to find the channel id and group id
Set url to https://graph.microsoft.com/v1.0/teams/<GROUP_ID>/channels/<CHANNEL_ID>/messages
Add body
{ "body": { "contentType": "html", "content": "<b>{{issue.summary}}</b><p>{{issue.description}}</p>" } }
Find the Team Id and Channel Id
This URL contains 3 pieces of information. The first is the Channel ID this begins with the 19% or 19:, the second is the GroupID which is associated with the Team, and the Third is the Tenant ID associated with your environment/organization. For our purposes today, remove everything shown in red as shown in the screenshot. The value you are left with is your Team ID.
Reference API
https://docs.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http
https://docs.microsoft.com/en-us/graph/api/channel-list-messages?view=graph-rest-1.0&tabs=http