Skip to content

Latest commit

 

History

History
138 lines (96 loc) · 7.23 KB

File metadata and controls

138 lines (96 loc) · 7.23 KB
page_type description products languages extensions urlFragment
sample
This sample provides a customizable Node.js connector for systems with webhook support, ideal for integration with Microsoft Teams.
office-teams
office
office-365
Nodejs
contentType createdDate
samples
07/07/2021 01:38:26 PM
officedev-microsoft-teams-samples-connector-generic-nodejs

Important

The existing Microsoft 365 (previously called Office 365) connectors across all cloud platforms are nearing deprecation, and the creation of new Microsoft 365 connectors will soon be blocked. For more information on the schedule and how the Workflows app provides a more flexible and secure experience, see retirement of Microsoft 365 connectors within Microsoft Teams.

Generic Connector

This generic connector, built with Node.js, is customizable for any system that supports webhooks, enabling quick and efficient integration with Microsoft Teams. By following the provided setup, users can configure this connector to send notifications from various sources directly into Teams channels, enhancing workflow and communication.

Included Features

  • Connectors

Interaction with app

connector_generic

Prerequisites

To complete this tutorial, you need the following tools. If you don't already have them you can install them from these links.

Setup

Note these instructions are for running the sample on your local machine.

  1. Open a new command prompt window.

  2. Change to the directory that contains the ngrok.exe application.

  3. In the command prompt

    Run ngrok - point to port 3978

ngrok http 3978 --host-header="localhost:3978"

Alternatively, you can also use the dev tunnels. Please follow Create and host a dev tunnel and host the tunnel with anonymous user access command as shown below:

devtunnel host -p 3978 --allow-anonymous
  1. Make note of the https:// Forwarding URL. This URL will be your [BASE_URI] like https://1234.ngrok-free.app if you are using Ngrok and if you are using dev tunnels, your URL will be like: https://12345.devtunnels.ms which will be used in later steps

  2. Configure your own connector

connector_setup

  • Open Connector Developer Portal and select New Connector. connector_setup

  • Fill in all the basic details such as name, logo, descriptions etc. for the new connector.

  • For the configuration page, you'll use our sample code's setup endpoint: https://[BASE_URI]/connector/setup connector_setup

  • For Valid domains, make enter your domain's http or https URL, e.g. XXXXXXXX.ngrok-free.app and if you are using dev tunnels then your domain will be 12345.devtunnels.ms.

  • Click on Save. After the save completes, you will see your connector ID in address bar.

  1. In the ~/views/connectorconfig.jade file line 27 and replace tunnelURL to the ngrok https forwarding url from the above.

connector_setup

  1. Install all the dependencies by running npm install in root directory.
npm install
  1. Run the sample using
node server.js
  1. This step is specific to Teams.
    • Edit the manifest.json contained in the appManifest folder to replace your Microsoft Replace <<CONNECTOR_ID>> field in ~/appManifest/manifest.json file with your newly registered
    • Edit the manifest.json and update <<AppDomain>> Example. if you are using ngrok it would be https://1234.ngrok-free.app then your app domain-name will be 1234.ngrok-free.app and if you are using dev tunnels then your domain will be 12345.devtunnels.ms.
    • Zip up the contents of the appManifest folder to create a manifest.zip (Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package)
    • Upload the manifest.zip to Teams (In Teams Apps/Manage your apps click "Upload an app". Browse to and Open the .zip file. At the next dialog, click the Add button.)
    • Add the app to personal/team/groupChat scope (Supported scopes).

Running the sample

Setup your App in Teams setup

App list to connect for notifications (Select App from the list which you want to connect for notifications.) setup

Select App to get notifications (Configure your selected application.) setup

Selected App configuration (Give some digest name and select topics to get connect) Configure

App is now configured for notification (you will be get notify of that app which is connected with channel.) Connected

Further reading

For more information about getting started with Teams, please review the following resources:

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.