Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
page_type description products languages extensions
sample
Sample Office 365 Connector generating notifications to teams channel.
office-teams
office-365
csharp
contentType technologies createdDate
samples
Connectors
1/16/2018 10:21:42 PM

Microsoft Teams Sample Connector

This is an MVC sample task management application generated using the ASP.NET Web Application (.NET Framework) template. The majority of the code is related to either basic MVC configuration or Task management.

The main connector code is found here:

  • ConnectorController.cs - Setup & Save actions
  • TaskController.cs - Create & Update actions

This application simulates a real task management system and allows users to create and view tasks. The content is randomly generated to simulate how notification can be sent into Microsoft Teams channel using connector.

For more information on developing apps for Microsoft Teams, please review the Microsoft Teams developer documentation.

Setup Connector

Welcome card

Task manager portal

Create new task

Task details

Task card by connector

Update task card

Prerequisites

The minimum prerequisites to run this sample are:

  • The latest update of Visual Studio. You can download the community version here 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. These instructions assume you are using ngrok.

Note: some features in the sample require that you using Public Developer Preview mode in Microsoft Teams.

How to see the connector working in Microsoft Teams

  1. Upload your custom app in Microsoft Teams using this manifest file.
  2. Configure the Teams ToDo Notification connector.
  3. Select either Create or Update on the registration page and click Save.
  4. Once the connector is configured, you will get a notification in channel with link to the Task Manager application.
  5. Go to Task Manager portal and click on Create New and enter the task details and Save.
  6. You will see the MessageCard in the registered Teams channel.
  7. You can try the actionable buttons available on the message card.

Note: With the above instructions, you can use sample connector which is deployed on Azure. Please follow the instructions below to create your own connector.

Configure your own connector

The sample shows a simple implementation of a connector registration implementation. It also sends a connector card to the registered connector via a process triggered "externally."

  1. Open the TeamsToDoAppConnector.sln solution with Visual Studio.
  2. Begin your tunnelling service to get an https endpoint.
    1. Open a new command prompt window.
    2. Change to the directory that contains the ngrok.exe application.
    3. In the command prompt, run the command ngrok http [port] --host-header=localhost.
    4. Ngrok will fill the entire prompt window. Make note of the https:// Forwarding URL. This URL will be your [BASE_URI] referenced below.
    5. Minimize the ngrok Command Prompt window. It is no longer referenced in these instructions, but it must remain running.
  3. Register a new connector in the Connector Developer Portal
    1. Fill in all the basic details such as name, logo, descriptions etc. for the new connector.
    2. For the configuration page, you'll use our sample code's setup endpoint: https://[BASE_URI]/connector/setup
    3. For Valid domains, make enter your domain's http or https URL, e.g. XXXXXXXX.ngrok.io.
    4. Enable the action on connector card by selecting the Yes radio button and enter the update endpoint: https://[BASE_URI]/Task/Update
    5. Click on Save. After the save completes, you will see your connector id.
  4. In the Web.config file, set the configuration.appSettings.Base_Uri variable to the ngrok https forwarding url from the above.
  5. In Visual Studio, click the play button.
  6. Now you can sideload your app package and test your new connector.

More Information

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