Skip to content

Python Migration - Bot Request Approval #1694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Mohammed-MSFT
Copy link
Contributor

No description provided.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new Python implementation of the “Bot Request Approval” Teams sample, including code, infrastructure, configuration, and dev tooling, and corrects a path in the existing Node.js README.

  • Introduces Python bot logic (teamsBot, app, config), dependencies, and manifest.
  • Adds infrastructure templates (Bicep, parameters), Teams Toolkit YAML, and VS Code tasks/settings.
  • Fixes a directory path typo in the Node.js sample README.

Reviewed Changes

Copilot reviewed 39 out of 39 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
samples/bot-request-approval/python/server/bots/teamsBot.py Python TeamsBot class for handling activities
samples/bot-request-approval/python/app.py Aiohttp server setup and BotFramework integration
samples/bot-request-approval/python/config.py Environment-based bot configuration
samples/bot-request-approval/python/requirements.txt Added Python package requirements
samples/bot-request-approval/python/m365agents.yml Toolkit provisioning pipeline metadata
samples/bot-request-approval/python/m365agents.local.yml Local dev provisioning and deployment actions
samples/bot-request-approval/python/infra/azure.bicep Azure BotService and Teams channel resources
samples/bot-request-approval/python/infra/azure.parameters.json Parameters for ARM/Bicep deployment
samples/bot-request-approval/python/assets/sample.json Sample catalog entry with metadata
samples/bot-request-approval/python/appManifest/manifest.json Teams app manifest for Python sample
samples/bot-request-approval/python/README.md Documentation for Python sample setup and usage
samples/bot-request-approval/python/.vscode/* VS Code debug and task configurations
samples/bot-request-approval/python/.gitignore Updated ignore rules for Python sample
samples/bot-request-approval/nodejs/Readme.md Corrected path to samples/bot-request-approval/nodejs
Comments suppressed due to low confidence (5)

samples/bot-request-approval/python/assets/sample.json:27

  • The metadata TEAMS-SERVER-PLATFORM is set to "express", but this is a Python sample. Please update it to reflect the correct platform (e.g., "python" or remove it).
        "value": "express"

samples/bot-request-approval/python/README.md:19

  • The README mentions ".NET Core" but this is a Python sample. Please update the description to reference Python and the appropriate runtime (e.g., Aiohttp).
This sample demonstrates a Teams bot that facilitates task approval requests within group chats. Users can submit requests via Adaptive Cards, which managers can then approve or reject directly in the chat. Other group members can view request details, while only requesters and managers have access to actionable options. The sample supports Azure and includes comprehensive setup guidance, leveraging .NET Core and the Microsoft 365 Agents Toolkit for Visual Studio.

samples/bot-request-approval/python/README.md:4

  • The frontmatter lists the products: key twice. Please remove the duplicate to avoid confusion.
products:

samples/bot-request-approval/python/README.md:25

  • [nitpick] There are two identical "## Included Features" sections. Please consolidate or remove the duplicate heading.
## Included Features

samples/bot-request-approval/python/.vscode/extensions.json:4

  • The trailing comma after the last array element is invalid JSON in extensions.json. Please remove it.
        "ms-python.python",


# Handle Adaptive Card submit actions
if activity.name == "adaptiveCard/action":
action = activity.value.get("action") # Extract submitted action
Copy link
Preview

Copilot AI Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable action is retrieved but never used. Either use it in your logic or remove this line.

Suggested change
action = activity.value.get("action") # Extract submitted action

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIxed

Comment on lines 36 to 37
subscriptionId: ${{AZURE_SUBSCRIPTION_ID}} # The AZURE_SUBSCRIPTION_ID is a built-in environment variable. TeamsFx will ask you select one subscription if its value is empty. You're free to reference other environment varialbe here, but TeamsFx will not ask you to select subscription if it's empty in this case.
resourceGroupName: ${{AZURE_RESOURCE_GROUP_NAME}} # The AZURE_RESOURCE_GROUP_NAME is a built-in environment variable. TeamsFx will ask you to select or create one resource group if its value is empty. You're free to reference other environment varialbe here, but TeamsFx will not ask you to select or create resource grouop if it's empty in this case.
Copy link
Preview

Copilot AI Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo in the comment: "varialbe" should be "variable".

Suggested change
subscriptionId: ${{AZURE_SUBSCRIPTION_ID}} # The AZURE_SUBSCRIPTION_ID is a built-in environment variable. TeamsFx will ask you select one subscription if its value is empty. You're free to reference other environment varialbe here, but TeamsFx will not ask you to select subscription if it's empty in this case.
resourceGroupName: ${{AZURE_RESOURCE_GROUP_NAME}} # The AZURE_RESOURCE_GROUP_NAME is a built-in environment variable. TeamsFx will ask you to select or create one resource group if its value is empty. You're free to reference other environment varialbe here, but TeamsFx will not ask you to select or create resource grouop if it's empty in this case.
subscriptionId: ${{AZURE_SUBSCRIPTION_ID}} # The AZURE_SUBSCRIPTION_ID is a built-in environment variable. TeamsFx will ask you select one subscription if its value is empty. You're free to reference other environment variable here, but TeamsFx will not ask you to select subscription if it's empty in this case.
resourceGroupName: ${{AZURE_RESOURCE_GROUP_NAME}} # The AZURE_RESOURCE_GROUP_NAME is a built-in environment variable. TeamsFx will ask you to select or create one resource group if its value is empty. You're free to reference other environment variable here, but TeamsFx will not ask you to select or create resource group if it's empty in this case.

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

- uses: arm/deploy # Deploy given ARM templates parallelly.
with:
subscriptionId: ${{AZURE_SUBSCRIPTION_ID}} # The AZURE_SUBSCRIPTION_ID is a built-in environment variable. TeamsFx will ask you select one subscription if its value is empty. You're free to reference other environment varialbe here, but TeamsFx will not ask you to select subscription if it's empty in this case.
resourceGroupName: ${{AZURE_RESOURCE_GROUP_NAME}} # The AZURE_RESOURCE_GROUP_NAME is a built-in environment variable. TeamsFx will ask you to select or create one resource group if its value is empty. You're free to reference other environment varialbe here, but TeamsFx will not ask you to select or create resource grouop if it's empty in this case.
Copy link
Preview

Copilot AI Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo in the comment: "grouop" should be "group".

Suggested change
resourceGroupName: ${{AZURE_RESOURCE_GROUP_NAME}} # The AZURE_RESOURCE_GROUP_NAME is a built-in environment variable. TeamsFx will ask you to select or create one resource group if its value is empty. You're free to reference other environment varialbe here, but TeamsFx will not ask you to select or create resource grouop if it's empty in this case.
resourceGroupName: ${{AZURE_RESOURCE_GROUP_NAME}} # The AZURE_RESOURCE_GROUP_NAME is a built-in environment variable. TeamsFx will ask you to select or create one resource group if its value is empty. You're free to reference other environment variable here, but TeamsFx will not ask you to select or create resource group if it's empty in this case.

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor

@Harikrishnan-MSFT Harikrishnan-MSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Kindly add the build pipeline, include this sample in the main README file, and resolve the Copilot comments.

Copy link
Collaborator

@Pawank-MSFT Pawank-MSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix the comments

---
page_type: sample
description: This Teams bot enables users to request task approval from managers within group chats. Managers can quickly approve or reject requests, while other members view request details only.
products:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove one products

Copy link
Contributor Author

@Mohammed-MSFT Mohammed-MSFT Jun 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Fixed

This sample demonstrates a Teams bot that facilitates task approval requests within group chats. Users can submit requests via Adaptive Cards, which managers can then approve or reject directly in the chat. Other group members can view request details, while only requesters and managers have access to actionable options. The sample supports Azure and includes comprehensive setup guidance, leveraging .NET Core and the Microsoft 365 Agents Toolkit for Visual Studio.

## Included Features
* Bots
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate "## Included Features" section. Remove one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

devtunnel host -p 3978 --allow-anonymous
```

3) Create [Azure Bot resource resource](https://docs.microsoft.com/azure/bot-service/bot-service-quickstart-registration) in Azure
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Create [Azure Bot resource resource]"
Double "resource". Should be "Create [Azure Bot resource]".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants