Send issue to MS Teams channel



Step 1. Setup Authentication in MS Teams

  1. Goto https://portal.azure.com/ and login

  2. Click on App registrations


  3. Click on view API Permission


  4. Add the scope needed, we added these




  5. Click Enterprise applications in the buttom

  6. Click the big blue button: Grant admin consent

  7. Click on Authentications menu.

  8. Click Add a redirect. Add the url to iHub as stated in the OAuth credential page.




  9. Click on Overview and click on the Endpoints this will display all endpoints needed for your instance

  10. 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

  1. Click on Credentials

  2. Select Oauth2 and enter a name, click add

  3. Fill inte form:





Set up an action to send data to MS Teams channel

  1. Click on integrations

  2. Click New → Action and create.

  3. Select POST as method

  4. Add URL to your channel. See Find the Team Id and Channel Id below to find the channel id and group id

  5. Set url to https://graph.microsoft.com/v1.0/teams/<GROUP_ID>/channels/<CHANNEL_ID>/messages

  6. Add body



  7. { "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

https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-configure-app-access-web-apis

https://developer.microsoft.com/en-us/graph/graph-explorer