| page_type | sample | ||||
|---|---|---|---|---|---|
| description | Demonstrating on how to implement sequential flow, user specific view and up-to-date adaptive cards in bot. | ||||
| products |
|
||||
| languages |
|
||||
| extensions |
|
||||
| urlFragment | officedev-microsoft-teams-samples-bot-sequential-flow-adaptive-cards-python |
Demonstrating on how to implement sequential flow, user specific view and up-to-date adaptive cards in bot.
- Incident Creation
- Choose Category
- Choose Sub Category
- Create Incident
- Edit/ Approve/ Reject Incident
- List Incidents
- Bots
- Adaptive Cards
Please find below demo manifest which is deployed on Microsoft Azure and you can try it yourself by uploading the app package (.zip file link below) to your teams and/or as a personal app. (Sideloading must be enabled for your tenant, see steps here).
Sequential workflow adaptive cards: Manifest
This App talks about the Teams Bot User Specific Views and Sequential Workflows in adaptive card with python
This bot has been created using Bot Framework v4, it shows how to create a simple bot that accepts food order using Adaptive Cards V1.4
This is a sample app that provides an experience of managing incidents. This sample makes use of Teams platform capabilities like Universal Bots with below mentioned capabilities. User Specific Views Sequential Workflows Up to date cards
- Microsoft Teams is installed and you have an account
- Python SDK min version 3.6
- dev tunnel or ngrok latest version or equivalent tunnelling solution
The simplest way to run this sample in Teams is to use Microsoft 365 Agents Toolkit for Visual Studio Code.
- Ensure you have downloaded and installed Visual Studio Code
- Install the Microsoft 365 Agents Toolkit extension and Python Extension
- Select File > Open Folder in VS Code and choose this samples directory from the repo
- Press CTRL+Shift+P to open the command box and enter Python: Create Environment to create and activate your desired virtual environment. Remember to select
requirements.txtas dependencies to install when creating the virtual environment. - Using the extension, sign in with your Microsoft 365 account where you have permissions to upload custom apps
- Select Debug > Start Debugging or F5 to run the app in a Teams web client.
- In the browser that launches, select the Add button to install the app to Teams.
If you do not have permission to upload custom apps (sideloading), Microsoft 365 Agents Toolkit will recommend creating and using a Microsoft 365 Developer Program account - a free program to get your own dev environment sandbox that includes Teams.
Note these instructions are for running the sample on your local machine, the tunnelling solution is required because the Teams service needs to call into the bot.
-
Clone the repository
git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
-
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
-
Register a new application in the Microsoft Entra ID – App Registrations portal.
A) Select New Registration and on the register an application page, set following values:
* Set name to your app name.
* Choose the supported account types (any account type will work)
* Leave Redirect URI empty.
* Choose Register.
B) On the overview page, copy and save the Application (client) ID, Directory (tenant) ID. You'll need those later when updating your Teams application manifest and in the appsettings.json.
C) Navigate to API Permissions, and make sure to add the following permissions:
Select Add a permission
* Select Add a permission
* Select Microsoft Graph -> Delegated permissions.
* User.Read (enabled by default)
* Click on Add permissions. Please make sure to grant the admin consent for the required permissions.
-
Create Azure Bot resource resource in Azure
- Use the current
httpsURL you were given by running the tunneling application. Append with the path/api/messagesused by this sample - Ensure that you've enabled the Teams Channel
- If you don't have an Azure account you can use this Azure free account here
- Use the current
-
In a terminal, go to
samples\bot-sequential-flow-adaptive-cards/python -
Activate your desired virtual environment
-
Install dependencies by running
pip install -r requirements.txtin the project folder. -
Update the
config.pyconfiguration for the bot to use the Microsoft App Id and App Password from the Bot Framework registration. (Note the App Password is referred to as the "client secret" in the azure portal and you can always create a new client secret anytime.) -
This step is specific to Teams.
- Edit the
manifest.jsoncontained in theappManifestfolder to replace your Microsoft App Id (that was created when you registered your bot earlier) everywhere you see the place holder string${{AAD_APP_CLIENT_ID}}and${{TEAMS_APP_ID}}(depending on the scenario the Microsoft App Id may occur multiple times in themanifest.json) - Zip up the contents of the
appManifestfolder to create amanifest.zip - Upload the
manifest.zipto Teams (in the Apps view click "Upload a custom app")
- Edit the
- Upload the manifest.zip to Teams (in the Apps view click "Upload a custom app")
- Go to Microsoft Teams. From the lower left corner, select Apps
- From the lower left corner, choose Upload a custom App
- Go to your project directory, the ./appManifest folder, select the zip folder, and choose Open.
- Select Add in the pop-up dialog box. Your app is uploaded to Teams.
sequenceDiagram
participant Teams User B
participant Teams User A
participant Teams Client
Teams User A->>+Teams Client: Enters create incident bot commands
Sample App->>+Teams Client: loads card with option
Teams User A->>+Teams Client: Enters required details and assigns to user B
Sample App-->>Teams Client: Posts the incidnet card with auto-refresh for user A and user B
Teams Client->>Teams User A: loads incident card with loading indicator
Teams Client->>Sample App: Automatically invokes refresh action
Sample App-->>Teams User A: Responds with Updated AC for the user A
Teams User B->>Teams Client: User opens the chat
Teams Client-->>Teams User B: Loads the incident base card
Teams Client->>Sample App: Automatically invokes refresh action
Sample App-->>Teams User B: Responds with card for user B with option to approve/reject
sequenceDiagram
participant Teams User B
participant Teams User A
participant Teams Client
Teams User A->>+Teams Client: Clicks on Incidents ME action in a group chat
opt App not installed flow
Teams Client-->>Teams User A: App install dialog
Teams User A->>Teams Client: Installs app
end
Teams Client->>+Sample App: Launches Task Module
Sample App-->>-Teams Client: Loads existing incidents created using Bot
Teams User A->>Teams Client: Selects incident to share in chat
Teams Client->>Sample App: Invoke action callback composeExtension/submitAction
Sample App-->>Teams Client: Posts Base card with auto-refresh for user A and user B
Teams Client->>Teams User A: loads incident card with loading indicator
Teams Client->>Sample App: Automatically invokes refresh action
Sample App-->>Teams User A: Responds with Updated AC for the user A
Teams User B->>Teams Client: User opens the chat
Teams Client-->>Teams User B: Loads the incident base card
Teams Client->>Sample App: Automatically invokes refresh action
Sample App-->>Teams User B: Responds with card for user B with option to approve/reject
- Run your bot with
python app.py
Install App:
Welcome UI:
Type in Chat: @Sequential Workflows (BotName) and Enter
Approve or Reject Incidents
Only the Assigned To person have the option to Approve or Reject
List Incidents
You can also interact with this app using messaging extension action which allows you to share incidents in group chats.
-
On selecting app from messaging extension,it checks whether bot is installed in chat/team. If not installed, user will get a option for justInTimeInstallation card.
-
After successful installation, list of all incidents will be available in messaging extension.
-
Users can select any incident from the list and share it to that chat or team.


















