Skip to main content Skip to footer

Search Crosser Knowledge Base

Microsoft Teams Modules

Modules Covered

  • Microsoft Teams Send
  • Microsoft Teams List Chats
  • Microsoft Teams Send Chat

These modules can be used to send messages to Microsoft Teams channels or chats. 

Entra ID App

The Microsoft Teams modules use Oauth 2.0 for authentication and requires an enterprise app in Entra ID with the right permissions. If you don't already have such an app, follow these steps:

  1. Firstly visit Entra ID here   to create a new App:
    • Give the App a name
    • Specify who should be able to signup using the App, most commonly 'single-tenant'
    • Set the Redirect URI as https://www.crosser.io (platform 'web')
  2. Once the app is registered you will see your client_id (called 'Application ID' in Entra ID). You will also need your tenantID, which can be found on the 'Overview' page. Copy both of these values.
  3. Navigate to the 'Certificates & secrets' tab and create a new secret_id: In 'Client secrets', select '+ New client secret'.). Save the value of your new secret.
  4. Now navigate to the 'API permissions' page. Click 'Add a permission'. For these modules to work you need Channel.ReadBasic.All, Team.ReadBasic.All and ChannelMessage.Send for the 'Microsoft Teams Send' module and ChatMessage.Send, Chat.ReadWrite permissions for the chat modules.

Create a credential in Control Center

Note: When you create a credential for use with these modules you do that as a specific user. This user will then be the 'sender' of these messages.

Follow these steps to create an Oauth 2.0 credential in Control Center for use with these modules:

  1. Use the tenant ID and client_id you obtained above and update the URL below:
https://login.microsoftonline.com/{YOUR_TENANT_ID}/oauth2/v2.0/authorize?  
client_id={YOUR_CLIENT_ID}
&response_type=code
&redirect_uri=https%3A%2F%2Fwww%2Ecrosser%2Eio
&response_mode=query
&scope=Channel.ReadBasic.All%20Team.ReadBasic.All%20ChannelMessage.Send
&state=12345

For the Chat modules, replace or add the following scopes:
ChatMessage.Send%20Chat.ReadWrite
  1. Remove the line breaks above and enter the full URL in an empty tab in your web browser and you will be redirected to a Microsoft authorization landing page. Follow the steps to authenticate your project.
  2. You will now be redirect to www.crosser.io. The redirect URL will look something like this:
    https://www.crosser.io/?code=YOUR_CODE&state=STATE&session_state=SESSION_STATE#/. Copy the code from the URL (starting after "code=" and up to the next "&"). The URL can usually be found at the top bar of most browsers.

For the next steps you need your client_id, client_secret and tenant ID from Azure and the code from the redirect URL above. You can now finish the credential in the Control Center:

  1. Go to 'Manage->Credentials' and click on 'Add Credential'
  2. Give the credential a name and select the type 'Oauth Authorization Code Grant'
  3. Enter "{refresh_token}" in the 'Refresh Token' field.
  4. Enter your client_id and client_secret in their respective fields.
  5. Enter https://login.microsoftonline.com/{TENANT-ID}/oauth2/v2.0/token as the Token Renewal URL. The scope field can be left empty. Remember to fill in your tenant ID in the URL.
  6. Create a request by clicking on the “+” sign above the settings. In the URL field, enter: https://login.microsoftonline.com/{TENANT-ID}/oauth2/v2.0/token
  7. Choose Action POST.
  8. Choose Content-Type: application/x-www-form-urlencoded
  9. In the Body, paste the following and replace "{YOUR CODE}" with the code you saved above. Remove line breaks when you enter it:
client_id={clientId}
&scope=offline_access%20ChatMessage.Send%20Chat.ReadWrite
&code={YOUR CODE}
&redirect_uri=https://www.crosser.io
&grant_type=authorization_code
&client_secret={clientSecret}
  1. Click on Execute to run your request and make sure you get a status of 200.
  2. Exit the request popup.
  3. Press Test Credentials and make sure you get a status 200.
  4. Press Add Credential

Using the Chat modules

When sending chat messages you need to reference the destination chat by providing its ID. If you are using Microsoft Teams from your browser, you can find the chat ID in the URL when you open the relevant conversation. The URL will look something like this: https://teams.live.com/_#/conversations/{CHAT-ID}?ctx=chat. If you are using the Teams app these IDs need to be fetched through the API. By using the List Chats module you can make an API request to list all chats you have access to and find their corresponding IDs. The Send Chat module can then be used to send messages to this chat.

About the author

Goran Appelquist

Göran has 20 years experience in leading technology teams. He’s the lead architect of our end-to-end solution and is extremely focused in securing the lowest possible Total Cost of Ownership for our customers.

"Hidden Lifecycle (employee) cost can account for 5-10 times the purchase price of software. Our goal is to offer a solution that automates and removes most of the tasks that is costly over the lifecycle.

My career started in the academic world where I got a PhD in physics by researching large scale data acquisition systems for physics experiments, such as the LHC at CERN. After leaving academia I have been working in several tech startups in different management positions over the last 20 years.

In most of these positions I have stood with one foot in the R&D team and another in the product/business teams. My passion is learning new technologies, use it to develop innovative products and explain the solutions to end users, technical or non-technical."