-
Notifications
You must be signed in to change notification settings - Fork 65
Add Teams Header Propagation sample #283
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
Add Teams Header Propagation sample #283
Conversation
…teams-header-propagation-sample
…n' into southworks/add/teams-header-propagation-sample
…n' into southworks/add/teams-header-propagation-sample
…teams-header-propagation-sample
There was a problem hiding this 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 introduces a sample project that demonstrates how to capture incoming request headers in a Microsoft Teams bot and propagate them to outgoing requests using the HeaderPropagation feature.
- Added configuration and documentation files (appsettings.json and README.md) to support header propagation.
- Implemented sample code in Program.cs, MyAgent.cs, and related extension methods and manifest to enable the new functionality.
- Updated the solution file to include the new sample project.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/samples/Teams/HeaderPropagation/appsettings.json | New configuration file with header propagation settings. |
| src/samples/Teams/HeaderPropagation/README.md | Documentation detailing sample setup and usage. |
| src/samples/Teams/HeaderPropagation/Program.cs | Sample application demonstrating middleware and agent registration. |
| src/samples/Teams/HeaderPropagation/MyAgent.cs | Implementation of the custom agent with Teams header extension. |
| src/samples/Teams/HeaderPropagation/HeaderPropagation.csproj | Project file for the new sample. |
| src/samples/Teams/HeaderPropagation/ConversationStateExtensions.cs | Extension methods for managing conversation state. |
| src/samples/Teams/HeaderPropagation/AppManifest/manifest.json | Teams manifest file for bot configuration. |
| src/Microsoft.Agents.SDK.sln | Updated solution file to integrate the new sample. |
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Microsoft.Agents.Builder.State; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not clear what is going on here, Why do you need this?
|
@sw-joelmut Im not clear on why we need this sample, or why it is using the teams extensions. All that is being show here is to asp.net's built into Header Propagation features. Somone requesting this can be pointed to use: https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.builder.headerpropagationapplicationbuilderextensions.useheaderpropagation?view=aspnetcore-9.0 Could you clarify why we should have a specific sample highlighting an asp.net feature? |
|
Hi @MattB-msft, The header propagation feature this sample illustrates is the one we are introducing in PR #143. As for the ConversationStateExtension, we wanted to have a Teams bot to show how to configure headers to be propagated inside the teams extension. The ConversationStateExtension was added as part of the Teams' edit event feature. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
I suspect we don't need this sample. However, we need to get with Teams to discover what headers they want carried over, and the User-Agent addition they want. They used "teamsai-dotnet/x.x.x" in Teams AI, but probably not what we want for the extension. Which raises the question... Can multiple instances of Unit tests can perform what this sample is doing? |
|
Hi @tracyboehrer, Unit tests can perform what this sample is doing? Can multiple instances of [HeaderPropagation] append User-Agent values? |
This PR depends on #143
Description
This PR adds a Teams sample capable of capturing incoming headers to later be propagated to outgoing requests based on the HeaderPropagationAttribute configured in the Extensions.Teams project.
Specific Changes
Testing
The following image shows the sample working and the chosen headers being propagated to the MS Teams service.
