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. |
|
|
|
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.
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.
- Connectors
To complete this tutorial, you need the following tools. If you don't already have them you can install them from these links.
- Git
- Node.js and NPM
- Get any text editor or IDE. You can install and use Visual Studio Code for free.
- An Office 365 account with access to Microsoft Teams, with sideloading enabled.
- If you want to run this code locally, use a tunnelling service like dev tunnel or ngrok latest version. These instructions assume you are using ngrok.
Note these instructions are for running the sample on your local machine.
-
Open a new command prompt window.
-
Change to the directory that contains the ngrok.exe application.
-
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
-
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 -
Configure your own connector
-
Open Connector Developer Portal and select New Connector.
-
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
-
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.
- In the
~/views/connectorconfig.jade
file line 27 and replacetunnelURL
to the ngrok https forwarding url from the above.
- Install all the dependencies by running
npm install
in root directory.
npm install
- Run the sample using
node server.js
- This step is specific to Teams.
- Edit the
manifest.json
contained in theappManifest
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 behttps://1234.ngrok-free.app
then your app domain-name will be1234.ngrok-free.app
and if you are using dev tunnels then your domain will be12345.devtunnels.ms
. - Zip up the contents of the
appManifest
folder to create amanifest.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).
- Edit the
App list to connect for notifications (Select App from the list which you want to connect for notifications.)
Select App to get notifications (Configure your selected application.)
Selected App configuration (Give some digest name and select topics to get connect)
App is now configured for notification (you will be get notify of that app which is connected with channel.)
For more information about getting started with Teams, please review the following resources:
- Review Office 365 Connectors
- Review Understanding Teams app capabilities
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 [email protected] with any additional questions or comments.