Language

EventEnvelope Class

Definition

Represents the outer envelope for a Slack Events API callback, containing metadata and the inner event payload as received from Slack.

public class EventEnvelope : Microsoft.Agents.Extensions.Slack.Api.SlackModel
type EventEnvelope = class
    inherit SlackModel
Public Class EventEnvelope
Inherits SlackModel
Inheritance
EventEnvelope

Remarks

This class models the top-level structure of a Slack Events API request, including workspace, application, and authorization context, as well as the event-specific content. Use the strongly-typed properties for common envelope fields and the event_content property for the inner event payload. Additional or unmodeled fields are accessible via the AdditionalProperties dictionary. For more information on the envelope structure, see https://docs.slack.dev/apis/events-api/#callback-field.

Use Get<T>(String) and TryGet<T>(String, T) to access any field by dot-notation path. Top-level envelope fields (e.g. "team_id"), extension data fields, and nested event content fields using either the Slack JSON prefix "event." or the C# property prefix "event_content." are all supported.

var envelope = turnContext.Activity.GetChannelData<SlackChannelData>().EventEnvelope;
string workspaceId = envelope.Get<string>("team_id");
string channel     = envelope.Get<string>("event.channel");
string itemType    = envelope.Get<string>("event.item.type");
string blockType   = envelope.Get<string>("event.blocks[0].type");

Constructors

Name Description
EventEnvelope()

Properties

Name Description
AdditionalProperties

Catch-all for any envelope fields not explicitly modelled above.

api_app_id

Unique identifier for the application this event is intended for.

authorizations

Installation authorizations visible to this app for this event. Each element represents one installation in the scope of this event.

context_enterprise_id

Enterprise org through which the app receives this event (may be null).

context_team_id

The workspace through which the app receives this event.

event_content

The inner event content. Use named properties for common fields, or navigate any event-specific field with Get<T>(String). Serialized as "event" in the Slack JSON payload.

event_context

Identifier for this specific event; usable with the apps.event.authorizations.list API method.

event_id

Unique identifier for this event, globally unique across all workspaces.

event_time

Epoch timestamp (seconds) indicating when this event was dispatched.

is_ext_shared_channel

Whether the event occurred in an externally shared channel.

team_id

Unique identifier for the workspace where this event occurred.

token

Deprecated verification token. Slack recommends signed secrets instead.

type

Callback type. Typically "event_callback".

Methods

Name Description
Get<T>(String)

Gets a value at the given dot-notation path. Supports dot-separated property access and bracket array indexing (e.g. "message.attachments[0].text"). Returns default when the path does not exist or the value cannot be converted to T.

(Inherited from SlackModel)
GetData()

Returns the JsonObject used for path navigation. The default implementation lazily serializes this instance via JsonSerializer.SerializeToNode, making every property and [JsonExtensionData] field addressable. Override when the subclass is already backed by a JsonObject to return it directly.

(Inherited from SlackModel)
NormalizePath(String)

Normalizes a caller-supplied path before it is passed to the navigator. Override to remap C# property-name aliases to their JSON field names. The default implementation returns the path unchanged.

TryGet<T>(String, T)

Tries to get a value at the given dot-notation path. Returns false when the path does not exist or the value cannot be converted to T.

(Inherited from SlackModel)

Applies to