Language

BotRequestContext Class

Definition

Typed per-request context carried on RequestContext. Each field is stamped onto the outbound Options, where a DelegatingHandler can read it (for example, to authenticate as a specific bot app).

public class BotRequestContext : IEquatable<Microsoft.Teams.Core.Http.BotRequestContext>
type BotRequestContext = class
    interface IEquatable<BotRequestContext>
Public Class BotRequestContext
Implements IEquatable(Of BotRequestContext)
Inheritance
BotRequestContext
Implements

Remarks

The well-known values (agentic identity, bot app id) are derived from the activity via the factory methods, or set directly. The values flow as a parameter (no ambient state).

Constructors

Name Description
BotRequestContext()
BotRequestContext(BotRequestContext)

Fields

Name Description
AgenticIdentityKey

Option key under which AgenticIdentity is stamped onto the request options. Matches the key the bot authentication handler reads.

BotAppIdKey

Option key under which BotAppId is stamped onto the request options.

Properties

Name Description
AgenticIdentity

Gets the agentic identity to authenticate as, when the bot acts on behalf of an agentic app.

BotAppId

Gets the bot application (client) id to mint a token as.

EqualityContract

Methods

Name Description
<Clone>$()
Equals(BotRequestContext)
Equals(Object)
FromActivity(CoreActivity)

Builds context for an outbound activity: the bot is the sender, so the agentic identity and bot app id are both derived from From.

FromAgenticIdentity(AgenticIdentity)

Builds context carrying only the supplied agentic identity.

FromBotAppId(String)

Builds context carrying only the supplied bot app id, used as-is (no channel-prefix stripping). Use for proactive flows where the bot app id is known directly rather than derived from an activity.

FromInboundActivity(CoreActivity)

Builds context for an inbound activity: the bot is the recipient, so both the bot app id and the agentic identity are derived from Recipient (the bot's own account).

GetHashCode()
Merge(BotRequestContext, BotRequestContext)

Merges two contexts, with non-null fields from overrides taking precedence.

PrintMembers(StringBuilder)
ToString()

Operators

Name Description
Equality(BotRequestContext, BotRequestContext)
Inequality(BotRequestContext, BotRequestContext)

Applies to