Code Monkey home page Code Monkey logo

teams-dev-samples's Introduction

Microsoft Teams Development Community Samples

Microsoft Teams is highly extensible, allowing 3rd party and custom applications to run alongside the many Office 365 services already included in Teams. Just as you can add a Word tab or the Who bot in Teams, you can write your own tabs and bots. You can also write applications that run outside the Teams UI and use the Microsoft Graph API to access and curate Teams content.

Recently, Microsoft has enabled some of the features in Teams applications to work in Microsoft Outlook and the Microsoft 365 app. At the time of this writing, these are limited to personal tabs, search message extensions, and link unfurling. Many of the more recent samples work in these new locations.

This repository contains community samples that demonstrate different usage patterns for developing on Microsoft Teams as a platform. Samples are generally not production-ready, but are intended to show developers patterns and use cases for use in complete applications. Some samples are very bare bones to show how to do something specific, while others are partial or complete applications. Many are useful on their own, but it's up to you to check that they're secure and meet your standards.

This repo is maintained by the Microsoft 365 & Power Platform Community; please join our community calls for announcements and sample demos every other Thursday. The "pnp" in the URL is for "Patterns and Practices", and it's all about sharing our patterns and practices for building solutions on Microsoft 365.

If you're looking for Teams development samples, here's a handy guide:

  • Code-first samples from the community belong in this repo.
  • Code-first samples from Microsoft belong in this repo
  • Samples using Teams Toolkit live in this repo
  • Power Platform samples from the community - including some Teams samples - can be found in this repo

The easy way to browse through all the samples is to visit the Microsoft 365 Sample Solution Gallery.

Using the samples

To search all the samples, please visit our Sample Browser{target=_blank}, which aggreagates samples from this and other repositories.

To browse the samples in this repo, please visit the /samples folder. It contains a child folder for each sample, named with a prefix as follows:

Prefix Description
app- These are samples of apps that have multiple Teams app capabilities such as a tab and a bot
bot- These are apps that contain a chatbot for use in Teams
msgext- These are apps that contain one or more messaging extensions, including link unfurling, search, and action message extensions
tabs- These are apps that contain one or more tabs, including personal, group, channel, and meeting tabs

Due to the diversity of the samples and technologies, there are no fixed instructions for building or using the samples. Each sample includes a readme file with a description, screen shot(s), requirements, and build instructions.

Contributions

We welcome community contributions to the samples folder in this repository! If you've built something cool, or figured out how to do something that's usable by others, consider sharing it as a sample. Please see our contribution guidelines for details.

Questions or Problems?

Please do not open GitHub issues for support questions with Microsoft 365 or developer tools. The GitHub issues list should be used for sample requests and bug reports. This way we can more easily track actual issues or bugs from the code and keep the general discussion separate from the actual code.

If you have questions about how to develop Teams applications or any of the provided samples, please use the following resources:

Technology Location for issues/questions
General Teams development questions Stack Overflow for Teams
Bot Framework SDK Bot Framework resources
Microsoft Graph Microsoft Graph Support
Microsoft Teams JavaScript SDK Use the feedback link at the footer of the docs page
SharePoint Framework with Teams sp-dev-docs repository issue list

Contributions

These samples are from the Microsoft 365 developer community. We welcome your samples and suggestions for new ones.

Please have a look on our Contribution Guidance before submitting your pull requests, so that we can get your contribution processed as fast as possible. Thx.

Sharing is caring!

Additional resources

Teams applications

Bots

Tabs

teams-dev-samples's People

Contributors

ahmadiramin avatar anoopt avatar arun-msft avatar bobgerman avatar dependabot[bot] avatar derisen avatar garrytrinder avatar hiltongiesenow avatar hugoabernier avatar joaojmendes avatar joselarios avatar leeford avatar marcel-paalvast avatar markxa avatar mmsharepoint avatar nanddeepn avatar paolopia avatar petkir avatar pkbullock avatar pothan-msft avatar rabwill avatar rjesh-git avatar saikrishna-msft avatar sebastienlevert avatar siddharth-vaghasia avatar thomyg avatar varaprasad-msft avatar vesajuvonen avatar viveksharma-msft avatar wajeed-msft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

teams-dev-samples's Issues

how to get ConversationId and serviceURL when launching sample

Sample

bot-proactive-messaging

Author(s)

HiltonGiesenow

Question

Hello, I would like to know how to get the ConversationId and serviceURL when launching the sample.
When I launch the sample, these fields are empty.
I'm using the Node.js version of this sample.

image

Add logout to tab-aad-msal2

Sample

tab-aad-msal2

Author(s)

@BobGerman

Suggestion

Could we have a logout button on this app? I'm not quite sure how that flow should work within teams with msal2?

Cheers,
Rob

Are you willing to help?

No

Approval Scenario using universal action in Adaptive card - Node.js

Sample description

End User Scenario:

  1. User and manager installs App to a group chat.
  2. User send bot command to initiate approval request.
  3. User submits the request by filling details in Adaptive card.
  4. Manager gets bot notification for approval.
  5. Manager can approve/reject request from bot message itselft.
  6. User gets notified for status change.

Developer Scenario:

  1. Handle "raise approval request" commad in bot.
  2. Send Adaptive card response having Universal Action for Submit.
  3. Manager should see option to approve/reject and user should see option to edit or cancel by using up to date views.
  4. Once approved/rejected by manager, card should be updated with latest status for approval.

Docs Ref:
Universal Actions for Adaptive Cards

Are you willing to help?

Yes

Daily reminder bot using Node.js

Sample description

End User Scenario:

  1. Once App in installed, user gets welcome message to describe that bot supports daily reminder.
  2. User can type "set reminder" command
  3. Adaptive card in response would provide option to enter description and time for daily reminder.
  4. User gets reminder in form of Adaptive Card on specific time along with description provided.

Developer Scenario:

  1. Handle conversation update event to send welcome mesasge.
  2. Handle "set reminder" command to return Adaptive card with Time and description.
  3. On submit of reminder request, save the details on the reminder in memory/database.
  4. Send Proactive message to user on specified time on daily basis.

Docs Ref:
Send Proactive Message

Are you willing to help?

Yes

Test

Sample

tab-sso

Author(s)

BobGerman

Suggestion

Test

Are you willing to help?

No

Approval Scenario using Activity Feed notification - C#

Sample description

End User Scenario:

  1. User and manager installs App to personal scope.
  2. In Tab user can create approval request.
  3. Manager gets notification for approval.
  4. Manager can approve/reject request from Tab.
  5. User gets notified for status change.

Developer Scenario:

  1. Provide login to user and request for required permissions to send activity feed notification.
  2. Provide UI for user to raise new approval request (We can keep this information in memory storage).
  3. Send notification to user's manager abou approval request.
  4. Once approved/rejected by manager, notify user for status chage.

Docs Ref:
Send activity feed notification

Are you willing to help?

Yes

Messaging Extension for message reminder - Node.js

Sample description

End User Scenario:

  1. User can select any message and click on "Remind Me"
  2. User gets reminder in form of Adaptive Card in 1:1 chat along with deeplink to message.

Developer Scenario:

  1. Handle "Remind Me" command for Messaging Extension action.
  2. Show Adaptive card with Message Text which user has selected.
  3. Send Proactive message to user once user clicks on Submit.

Docs Ref:
Define messaging extension action commands
Send Proactive Message

Note: This can further expand to be a reminder app with scheduler to take Date and Time as input.

Are you willing to help?

Yes

Need Help to setup the Prerequisites for bot-microsoft-search-api

Sample

bot-microsoft-search-api

Author(s)

@AhmadiRamin

Question

Hi!
I tried to setup the Prerequisites for bot-microsoft-search-api but unfortunately, I wasn't able to to start the bot locally.
The 9. Setup SSO is a link to another URL that explain again the setup of AAD and bot service and SSO connection.

Can you please point out what exactly need to be done in this step 9. Setup SSO and what exactly permissions do we need to add to the AAD App.

Would appreciate If you can provide details setup of the Prerequisites as this is the important steps to make the bot works.

Messaging Extension for message reminder - C#

Sample description

End User Scenario:

  1. User can select any message and click on "Remind Me"
  2. User gets reminder in form of Adaptive Card in 1:1 chat along with deeplink to message.

Developer Scenario:

  1. Handle "Remind Me" command for Messaging Extension action.
  2. Show Adaptive card with Message Text which user has selected.
  3. Send Proactive message to user once user clicks on Submit.

Docs Ref:
Define messaging extension action commands
Send Proactive Message

Note: This can further expand to be a reminder app with scheduler to take Date and Time as input.

Are you willing to help?

Yes

Error running the the tab-activity-feed example

Sample

https://github.com/pnp/teams-dev-samples/tree/main/samples/tab-activity-feed

Author(s)

sebastienlevert

What happened?

Failed to compile
C:/tab/src/App.tsx
TypeScript error in C:/tab/src/App.tsx(65,25):
Object is of type 'unknown'. TS2571

63 |         _clearForm();
64 |       } catch (e) {

65 | setErrorMessage(e.message);
| ^
66 | }
67 | }
68 | };

Steps to reproduce

1.Follow the instructions
2.Run NPM START
3.GET the error

Expected behavior

App Running

Teams Client

  • Teams desktop client
  • Web browser
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Developer environment

No response

Browsers

  • Internet Explorer
  • Microsoft Edge
  • Google Chrome
  • FireFox
  • Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Node.js version

v14.16.1

Additional environment details

No response

move source team channel content to the Target team Channel

Sample Description (what should it do)

It will allow choosing a Source Team and Channel then Target Team and chanel then move the source channel content to the Target Channel. (Posts, tabs, files meetings etc...)

Are you Willing to Help?

Willing and ready. I just need a starting point.

Daily reminder bot using C#

Sample description

End User Scenario:

  1. Once App in installed, user gets welcome message to describe that bot supports daily reminder.
  2. User can type "set reminder" command
  3. Adaptive card in response would provide option to enter description and time for daily reminder.
  4. User gets reminder in form of Adaptive Card on specific time along with description provided.

Developer Scenario:

  1. Handle conversation update event to send welcome mesasge.
  2. Handle "set reminder" command to return Adaptive card with Time and description.
  3. On submit of reminder request, save the details on the reminder in memory/database.
  4. Send Proactive message to user on specified time on daily basis.

Are you willing to help?

Yes

Approval Scenario using Activity Feed notification - Node.js

Sample description

End User Scenario:

  1. User and manager installs App to personal scope.
  2. In Tab user can create approval request.
  3. Manager gets notification for approval.
  4. Manager can approve/reject request from Tab.
  5. User gets notified for status change.

Developer Scenario:

  1. Provide login to user and request for required permissions to send activity feed notification.
  2. Provide UI for user to raise new approval request (We can keep this information in memory storage).
  3. Send notification to user's manager abou approval request.
  4. Once approved/rejected by manager, notify user for status chage.

Docs Ref:
Send activity feed notification

Are you willing to help?

Yes

Send notification Teams in bot-b2c-chat-bot

Sample

https://github.com/pnp/teams-dev-samples/tree/main/samples/bot-b2c-chat-bot

Author(s)

@Saikrishna-MSFT @BobGerman

Question

Hello

I am trying to use the example bot-b2c-chatbot but I can't do that it is works because I am not sure what is the value of the variable Teams ServiceUrl.

Captura de pantalla de 2022-05-04 09-09-34

Right now I put the url of my team channel of Microsoft Teams and I get the next result when i send a notification to my team of Microsoft Teams.

image

I don't know because I receive a Empty Response.

Note: My BotService is Multi-tenant no Single-tenant like as the example i don't know if this is important

Regards

Create Outlook rules and folders

Sample description

As part of this week's Microsoft Global Hackathon, we're building out three new samples around Outlook rules and folders. We'd like at least one to be a custom tab for Microsoft Teams, but maybe would make all three, depending how far we get. The team is me, @MarkXA and @siddharth-vaghasia

The end goal is to provide a solution that will help end users who's orgs have recently moved from Gmail to Outlook. Specifically, we'd like to help them move over the Gmail filters that are left behind by current migration tools. It will require creating new rules in Outlook. It will also require creating new folders to replace the labels Gmail uses.

Sample 1 - Read, write, and delete Outlook rules and folders from a Teams app

Microsoft Teams is the fastest growing development platform in the Microsoft ecosystem. Microsoft, customers, and partners are learning and sharing new dev skills more on this platform than any other. We can build off existing sample code like Teams Tab with SSO and MSAL2 to ramp up a new Outlook rules and folders example quickly.

Sample 2 - Read Gmail filters and labels and package them to move to Outlook

From previous hackathons, we have a base of code that can read filters and labels from Gmail. We have the start of a JSON based export file. Creating a quality, public sample from this code will help move the project forward. This step alone will help some customers who need an export. And, it will provide a base others can build on and contribute to.

Sample 3 - Create Outlook rules and folders from a JSON import format

This sample code will complete the loop. It will read from a standard JSON import file that matches Sample 2. And it can be added to Sample 1 once it is completed. This sample can be built in parallel and can provide value on it's own once completed standalone.

Are you willing to help?

Yes

Error While Uploading manifest folder

Sample

msgext-dalle

Author(s)

@lee_ford

What happened?

Error while extracting package: Please ensure there are no folders in your app package and that your app package contains only the manifest.json and the two required icon files at its root level. For an easier experience creating your app package, install Developer Portal from the Teams Store.
manifest.zip

Steps to reproduce

  1. I tried to upload the package in Teams
  2. Face the same error

Expected behavior

the same error
Screenshot 2023-08-13 at 8 01 18 PM

Teams Client

  • Teams desktop client
  • Web browser
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Developer environment

macOS

Browsers

  • Internet Explorer
  • Microsoft Edge
  • Google Chrome
  • FireFox
  • Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Node.js version

v18.17.1

Additional environment details

No response

[SUGGESTION] App virtual events meeting extensibility docs improvements

The docs for the following sample are difficult to follow due to gaps in the documentation https://github.com/pnp/teams-dev-samples/tree/master/samples/app-virtual-events-meeting-extensibility#create-microsoft-teams-meeting-with-calling--meeting-bot-and-add-a-custom-app-to-the-meeting-programmatically--sample-code

Request 1:
Step 3.4
image
Where do the COSMOS DB details come from? The previous docs do not setup a DB. If they are not needed it should be said clearly in the documentation.

Request 2
Step 4 is lacking details how to upload the app package into Teams. It does not explain to switch the client to Dev Preview which is required by the app manifest.
Also step 4 does not detail how to run the service. Example from another Teams sample https://github.com/OfficeDev/microsoft-teams-sample-meetings-token#step-4-build-and-run-the-service

Improve documentation for App Registration regarding multi-tenant configuration

Sample

tab-aad-msal2

Authors

@BobGerman

Suggestion (the more details, the better)

App Registration

Please add the following detail to the documentation

  • SPA Redirect URI (not Web Redirect URI)
  • no implicit grant
  • optional: select the multi-tenant option

SPA-MSAL-Config

Code Changes

For the multi-tenant configuration, the following changes are required:

  • use the common endpoint in the Config.js instead of the tenant ID
    export const authority = "https://login.microsoftonline.com/common";

  • to the request I added the extraQueryParameters: {domain_hint: 'organizations'}
    this.request = { scopes: ["user.read"], extraQueryParameters: {domain_hint: 'organizations'} }

Approval Scenario using universal action in Adaptive card - C#

Sample description

End User Scenario:

  1. User and manager installs App to a group chat.
  2. User send bot command to initiate approval request.
  3. User submits the request by filling details in Adaptive card.
  4. Manager gets bot notification for approval.
  5. Manager can approve/reject request from bot message itselft.
  6. User gets notified for status change.

Developer Scenario:

  1. Handle "raise approval request" commad in bot.
  2. Send Adaptive card response having Universal Action for Submit.
  3. Manager should see option to approve/reject and user should see option to edit or cancel by using up to date views.
  4. Once approved/rejected by manager, card should be updated with latest status for approval.

Docs Ref:
Universal Actions for Adaptive Cards

Are you willing to help?

Yes

What value to put in the TeamsServiceUrl for bot-b2c-chat-bot?

Sample (which sample are you talking about)

bot-b2c-chat-bot

Authors

@Saikrishna-MSFT
@arun-msft

Question (the more details, the better)

Hi- thanks for the sample. I'm not sure what to put for the "TeamsServiceUrl" in the appsetting.json.
If i put my bot ngrok endpoint i get 404's
If i put https://webchat.botframework.com/ i get 403's
but either way i get an exception when i call await connectorClient.Conversations.CreateConversationAsync(parameters);
in the WebChatBot.cs.
Thanks for any guidance.

Question

What value to put in the TeamsServiceUrl for bot-b2c-chat-bot

Help in Implementing the B2C Chatbot

Sample

bot-b2c-chat-bot

Author(s)

@Saikrishna-MSFT @arun-msft

Question

Hello,
I am student trying to implement the b2c chatbot available in the repository. I am having a few troubles doing the same. Can somebody connect with me and guide for the implementation. Also I need help in implementing the video call function through my personal bot that I've been building as a part of my internship. If anyone here can help regarding these issues, I would like to connect with them and would be grateful.

Getting this error when I try to deploy it:[Error] - Failed to Execute lifecycle deploy due to failed action: {"name":"build app","uses":"cli/runNpmCommand"}. ScriptExecutionError:Unable to execute script action.. Env output: {}

Sample

bot-azure-search-openai-t

Author(s)

Garry Trinder

What happened?

I tried to deploy the bot, I got this error:

[2024-06-10T16:00:59.748Z] [Error] - Failed to Execute lifecycle deploy due to failed action: {"name":"build app","uses":"cli/runNpmCommand"}. ScriptExecutionError:Unable to execute script action.. Env output: {}
[2024-06-10T16:00:59.750Z] [Info] - Execution summary:

Summary:
(×) Error: Lifecycle stage deploy failed.
(√) Done: cli/runNpmCommand(install dependencies) was executed successfully.
(√) Done: Successful execution of the npm install command at /Users/izzatullobaltabaev/Downloads/pnp teams-dev-samples main samples-bot-azure-search-openai-ts-3/.
(×) Error: cli/runNpmCommand(build app) failed.
(×) Error: Unable to execute script action.
(!) Warning: azureAppService/zipDeploy was not executed.

Steps to reproduce

1.Provisioned
2.Deployed
3.

Expected behavior

to be deployed

Teams Client

  • Teams desktop client
  • Web browser
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Developer environment

macOS

Browsers

  • Internet Explorer
  • Microsoft Edge
  • Google Chrome
  • FireFox
  • Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Node.js version

v16

Additional environment details

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.