How to create a Teams app to send surveys to different users and channels within an organization

Manav Prajapati 5 Reputation points
2024-02-08T09:43:18.1066667+00:00

I am working on developing a Teams app that will enable an admin to create surveys and send them to different users and channels within an organization. The surveys will have different question types, including open-ended, polls, and multiple-choice questions. I have already researched using the Graph API to obtain channels and users, but I'm stuck on how to incorporate the bot and tab features. My current plan is to create an admin portal within a tab, where the admin can select the survey type to create with open dialog and enter the questions, while also selecting the users/channels to send the survey to. Once the survey is sent, users will be able to fill it out and I need to store survey information in my database. If the admin creates a survey from the tab and selects the users/channels, I believe I can send the survey via the bot. However, I am unsure how the bot can access the survey details and determine which users/channels are selected. Furthermore, does the bot have the functionality to send messages to anyone in the organization? My questions are:

  • What parts of the app should be developed using bot and tab features, and how should they be implemented?
  • What resources should I consult to create this app?
  • If anyone org admin add my app to their teams organisation then the app can able to communicate with all the users and channel without adding app in every team's channel like adding tab?
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,891 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,743 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,469 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Prasad-MSFT 5,481 Reputation points Microsoft Vendor
    2024-02-08T11:01:14.9166667+00:00

    You can utilize both the bot and tab capabilities to develop your Teams app. Here's how you can implement each feature:

    Bot: The bot capability will allow you to create a conversational interface for your app. You can use the bot to send the survey to selected users and channels, as well as handle user responses. To implement the bot functionality, you can follow the documentation on Bots in Microsoft Teams. The bot can access the survey details and determine which users/channels are selected by storing this information in your app's backend database. When sending the survey, the bot can retrieve the necessary details from the database and send personalized messages to each user or channel. Tab: The tab capability will provide an admin portal where the admin can create surveys and manage the app's settings. You can create a tab that hosts your admin portal, allowing the admin to select the survey type, enter questions, and choose the users/channels to send the survey to. To implement the tab functionality, you can refer to the documentation on Microsoft Teams tabs. The tab can be developed as a web page or web app that is embedded within Teams. The admin can access the tab and interact with the admin portal to create and manage surveys.

    To summarize the flow of your app:

    1. Admin opens the app's tab in Teams and accesses the admin portal.
    2. Admin selects the survey type, enters questions, and chooses the users/channels to send the survey to.
    3. Admin saves the survey details in your app's backend database.
    4. Admin triggers the bot to send the survey to the selected users/channels.
    5. The bot retrieves the survey details from the database and sends personalized messages to each user or channel.
    6. Users receive the survey and can fill it out.
    7. User responses are collected by the bot and stored in your app's backend database.

    Regarding your question about the bot's functionality to send messages to anyone in the organization, the bot can send messages to users and channels within the Teams environment. To create this app, you can consult the following resources: Bots in Microsoft Teams: This documentation provides an overview of bots in Teams and guides you through the process of building a bot. Microsoft Teams tabs: This documentation explains how to create tabs in Teams and customize the tab experience. Microsoft Teams samples: The official Microsoft Teams samples repository on GitHub provides sample code and projects that can help you understand and implement different features of Teams apps.

    Regarding your question about app communication with users and channels without adding the app to every team's channel, you can achieve this by using the bot capability. Once an admin adds your app to their Teams organization, the bot can send messages to users and channels based on the survey details and selections made by the admin. The bot can access the necessary information from your app's backend database and send messages accordingly, without the need to add the app to every team's channel. Thanks, 

    Prasad Das *************************************************************************  If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.