| page_type | sample | ||||
|---|---|---|---|---|---|
| description | This is a sample app which shows connector authentication and sends notification on task creation. | ||||
| products |
|
||||
| languages |
|
||||
| extensions |
|
||||
| urlFragment | officedev-microsoft-teams-samples-connector-todo-notification-nodejs |
This is a sample connector application which demonstarates how to add authentication to connector configuration page and send notification on task creation.
- Microsoft Teams is installed and you have an account (not a guest account)
- NodeJS
- ngrok or equivalent tunneling solution
- M365 developer account or access to a Teams account with the appropriate permissions to install an app.
Note these instructions are for running the sample on your local machine.
-
Run ngrok - point to port 3978
ngrok http -host-header=rewrite 3978
-
Clone the repository
git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
-
Install node modules
Navigate to
samples/connector-todo-notification/nodejsInside node js folder, open your local terminal and run the below command to install node modules. You can do the same in Visual Studio code terminal by opening the project in Visual Studio code.
npm install
-
Configure your own connector :
Note:The below gif file shows a simple implementation of a connector registration implementation. It also sends a connector card to the registered connector via a process triggered "externally".
-
Register a new connector in the Connector Developer Portal
-
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/SimpleAuth -
For Valid domains, make entery of your domain's https URL, e.g. XXXXXXXX.ngrok.io.
-
Click on Save. After the save completes, you will see your connector id.
-
-
Go to the Application Registration Portal and sign in with the your account to create an application.
-
Navigate to Authentication under Manage and add the following redirect URLs:
-
https://<Your_Ngrok_Domain>/SimpleEnd -
Additionally, under the Implicit grant subsection select Access tokens and ID tokens
-
Click on Expose an API under Manage. Select the Set link to generate the Application ID URI in the form of api://{AppID}. Insert your fully qualified domain name (with a forward slash "/" appended to the end) between the double forward slashes and the GUID. The entire ID should have the form of: api://<your_ngrok_domain>/{AppID}
-
Navigate to API Permissions, and make sure to add the following delegated permissions:
- User.Read
- offline_access
- openid
- profile
-
Scroll to the bottom of the page and click on "Add Permissions".
-
-
Setting up .env configuration
- Update the
.envconfiguration with theClientIdandBaseUrl
Note:
ClientIdis your Microsoft-App-ID andBaseUrlis your Ngrok. - Update the
-
Run your app for server and client
npm start
-
This step is specific to Teams.
- Edit the
manifest.jsoncontained in theappPackagefolder to replace yourConnectorIdfield in~/app manifest/manifest.jsonfile with your ConnectorId inconnectorssection.-
Edit the
manifest.jsonforvalidDomains. if you are using ngrok it would behttps://1234.ngrok.iothen your domain-name will be1234.ngrok.io.Example :
"connectors": [ { "connectorId": "<<CONNECTOR_ID>>", "configurationUrl": "https://<<VALID-DOMAIN>>/Connector/Setup" } ]
-
Zip up the contents of the
app manifestfolder 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.zipto 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)
-
Click to Setup a Connector as given in the below image.

Welcome message after successfull SignIn

Now connector todo is configured.

Click Create button to create a new task.

Created task list will displayed as below image shows.

This is notify you in the channel group.

- For more information on developing apps for Microsoft Teams, please review the Microsoft Teams developer documentation.**
- For more information about getting started with Teams, please review the following resources:
- Review Getting Started with Authentications for Tabs
- Review Getting Started with Teams





