Microsoft Teams

Microsoft Teams


Modules

  1. Microsoft Teams List Chats
  2. Microsoft Teams Send Chat
These modules can be used to send chat messages to Microsoft Teams. 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 your 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. 

Authentication

The Microsoft Teams modules use Oauth 2.0 for authentication and will access the API on behalf of a specific user. Instructions on how to create an Oauth 2.0 credential for this module is as follows:

  1. Firstly visit this link and follow the guide on how to create an app in Microsoft AD. When registering your app, set your callback URL as https://www.crosser.io. Once the app is registered you will see your clientID and tenantID. Ýou will need these later, so make a copy of them.
  2. Navigate to the certificates and secrets tab and create a new secretID. Save the value of your new secret.
  3. Now navigate to the API permissions tab. Click "Add a permission>Microsoft Graph>Delegated permissions". For these modules to work you need ChatMessage.SendChat.ReadWrite permissions.
  4. Using your tenantID and ClientID you obtained from above and update the URL below. Remove line breaks when you enter it (it should all be one line):
    https://login.microsoftonline.com/{YOUR_TENANT_ID}/oauth2/v2.0/authorize?
    client_id={YOUR_CLIENT_ID}
    &response_type=code
    &redirect_uri=https%3A%2F%2Fcloud%2Ecrosser%2Eio
    &response_mode=query
    &scope=offline_access%20ChatMessage.Send%20Chat.ReadWrite
    &state=12345
  5. Ensure that your scope includes ChatMessage.SendChat.ReadWrite and offline_access. The state can be any value you like. Fill out the clientID and the tenantID (do not include the curly brackets in the final URL).
  6. 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.
  7. 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.

At this point you should have your ClientIDClientSecret and code. You can now create a credential in the Crosser Cloud platform.

  1. Create a new credential in the Crosser Cloud Platform. Select type: OAuth Authorization Code Grant.
  2. Enter "{refresh_token}" in the Refresh Token field.
  3. Enter your ClientID and ClientSecret in their respective fields.
  4. 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.
  5. 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
  6. Choose Action POST.
  7. Choose Content-Type: application/x-www-form-urlencoded
  8. 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

    • Related Articles

    • Microsoft Dynamics 365

      Modules - Microsoft Dynamics Create Record - Microsoft Dynamics Get Record How to register an App for Dynamics/Dataverse Introduction This guide will guide you through the process of registering an App for Dynamics/Dataverse and get the credentials ...
    • Introducing Crosser Control Center and a new Flow Studio

      Release Note Crosser Control Center Feb 2, 2023 Introducing Crosser Control Center With this release we are introducing some brand changes that gradually will be implemented across all documentation, illustrations and marketing materials. The main ...
    • Crosser Module Library

      Crosser Module Library This document presents the currently available standard modules for use with the Crosser Edge Node. The module library is constantly expanded with new modules. New modules are typically developed in a time frame of days to ...
    • Integration to Azure Event Grid

      Introduction Microsoft announced integration to Azure Event Grid via native MQTT v3.1.1 and v5 as a preview. With this option, you will be able to communicate with your Azure Event Grid directly without the need to go through the Azure IoT Hub. In ...
    • How to use RegEx

      How to use Regular Expressions (RegEx) In Crosser you can filter or split messages based on rules and conditions with different operators. For advanced use cases, it might be required to use more complex rules to fulfill the requirement. For such ...