Language

CoreActivity Class

Definition

Represents a core activity object that encapsulates the data and metadata for a bot interaction.

public class CoreActivity
type CoreActivity = class
Public Class CoreActivity
Inheritance
CoreActivity
Derived

Remarks

This class provides the foundational structure for bot activities including message exchanges, conversation updates, and other bot-related events. It supports serialization to and from JSON and includes extension properties for channel-specific data. Follows the Activity Protocol Specification: https://github.com/microsoft/Agents/blob/main/specs/activity/protocol-activity.md

Constructors

Name Description
CoreActivity(CoreActivity)

Creates a new instance of the CoreActivity class by copying properties from another activity.

CoreActivity(String)

Creates a new instance of the CoreActivity class with the specified activity type. Defaults to Message.

Fields

Name Description
ReflectionJsonOptions

Gets the JSON serializer options used for reflection-based serialization of extended activity types.

Properties

Name Description
ChannelId

Gets or sets the unique identifier for the channel on which this activity is occurring.

Conversation

Gets or sets the conversation information for this activity.

From

Gets or sets the sender account for this activity.

Id

Gets or sets the unique identifier for the activity.

Properties

Gets the extension data dictionary for storing additional properties not defined in the schema.

Recipient

Gets or sets the recipient account for this activity.

ReplyToId

Gets or sets the identifier of the activity this activity is a reply to.

ServiceUrl

Gets or sets the URL of the service endpoint for this activity.

Type

Gets or sets the type of the activity. See ActivityType for common values.

Methods

Name Description
FromJsonStreamAsync(Stream, CancellationToken)

Asynchronously deserializes a JSON stream into a CoreActivity object.

FromJsonStreamAsync<T>(Stream, CancellationToken)

Asynchronously deserializes a JSON value from the specified stream into an instance of type T.

FromJsonStreamAsync<T>(Stream, JsonTypeInfo<T>, CancellationToken)

Asynchronously deserializes a JSON stream into an instance of type T using the specified JsonTypeInfo<T> for source-generated serialization.

FromJsonString(String)

Deserializes a JSON string into a CoreActivity object.

ToJson()

Serializes the current activity to a JSON string.

ToJson<T>(JsonTypeInfo<T>)

Serializes the current activity to a JSON string using the specified JsonTypeInfo<T> for source-generated serialization.

ToJson<T>(T)

Serializes the specified activity instance to a JSON string using reflection-based serialization.

Extension Methods

Name Description
ToBotFrameworkActivity(CoreActivity)

Converts a CoreActivity to a Bot Framework Activity.

Applies to