Jaa


Activity Class

Definition

An Activity is the basic communication type for the Bot Framework 3.0 protocol.

public class Activity : Microsoft.Bot.Schema.ICommandActivity, Microsoft.Bot.Schema.ICommandResultActivity, Microsoft.Bot.Schema.IContactRelationUpdateActivity, Microsoft.Bot.Schema.IConversationUpdateActivity, Microsoft.Bot.Schema.IEndOfConversationActivity, Microsoft.Bot.Schema.IEventActivity, Microsoft.Bot.Schema.IHandoffActivity, Microsoft.Bot.Schema.IInstallationUpdateActivity, Microsoft.Bot.Schema.IInvokeActivity, Microsoft.Bot.Schema.IMessageDeleteActivity, Microsoft.Bot.Schema.IMessageReactionActivity, Microsoft.Bot.Schema.IMessageUpdateActivity, Microsoft.Bot.Schema.ISuggestionActivity, Microsoft.Bot.Schema.ITraceActivity, Microsoft.Bot.Schema.ITypingActivity
type Activity = class
    interface IActivity
    interface IConversationUpdateActivity
    interface IContactRelationUpdateActivity
    interface IInstallationUpdateActivity
    interface IMessageActivity
    interface IMessageUpdateActivity
    interface IMessageDeleteActivity
    interface IMessageReactionActivity
    interface ISuggestionActivity
    interface ITypingActivity
    interface IEndOfConversationActivity
    interface IEventActivity
    interface IInvokeActivity
    interface ITraceActivity
    interface IHandoffActivity
    interface ICommandActivity
    interface ICommandResultActivity
Public Class Activity
Implements ICommandActivity, ICommandResultActivity, IContactRelationUpdateActivity, IConversationUpdateActivity, IEndOfConversationActivity, IEventActivity, IHandoffActivity, IInstallationUpdateActivity, IInvokeActivity, IMessageDeleteActivity, IMessageReactionActivity, IMessageUpdateActivity, ISuggestionActivity, ITraceActivity, ITypingActivity
Inheritance
Activity
Implements

Remarks

The Activity class contains all properties that individual, more specific activities could contain. It is a superset type.

Constructors

Activity()

Initializes a new instance of the Activity class.

Activity(String, String, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, String, String, ChannelAccount, ConversationAccount, ChannelAccount, String, String, IList<ChannelAccount>, IList<ChannelAccount>, IList<MessageReaction>, IList<MessageReaction>, String, Nullable<Boolean>, String, String, String, String, String, SuggestedActions, IList<Attachment>, IList<Entity>, Object, String, String, String, String, Object, String, ConversationReference, String, Nullable<DateTimeOffset>, String, String, IList<String>, IList<TextHighlight>, SemanticAction, String)

Initializes a new instance of the Activity class.

Fields

ContentType

The HTTP Content-Type entity header that identifies an Activity media type resource.

Properties

Action

Gets or sets a string indicating whether the recipient of a contactRelationUpdate was added to or removed from the sender's contact list.

AttachmentLayout

Gets or sets the layout hint for multiple attachments. Default: list. Possible values are defined by AttachmentLayoutTypes.

Attachments

Gets or sets the attachments for the activity.

CallerId

Gets or sets a string containing an IRI identifying the caller of a bot. This field is not intended to be transmitted over the wire, but is instead populated by bots and clients based on cryptographically verifiable data that asserts the identity of the callers (e.g. tokens).

ChannelData

Gets or sets channel-specific content.

ChannelId

Gets or sets an ID that uniquely identifies the channel. Set by the channel.

Code

Gets or sets a code for endOfConversation activities that indicates why the conversation ended. Possible values are defined in EndOfConversationCodes.

Conversation

Gets or sets the conversation to which the activity belongs.

DeliveryMode

Gets or sets a delivery hint to signal to the recipient alternate delivery paths for the activity. The default delivery mode is "default". Possible values are defined in DeliveryModes.

Entities

Gets or sets the entities that were mentioned in the message.

Expiration

Gets or sets the time at which the activity should be considered to be "expired" and should not be presented to the recipient.

From

Gets or sets the sender of the message.

HistoryDisclosed

Gets or sets a value indicating whether the prior history of the channel is disclosed.

Id

Gets or sets an ID that uniquely identifies the activity on the channel.

Importance

Gets or sets the importance of the activity. Possible values are defined in ActivityImportance.

InputHint

Gets or sets a string indicating whether your bot is accepting, expecting, or ignoring user input after the message is delivered to the client (see InputHints.

Label

Gets or sets a descriptive label for the activity.

ListenFor

Gets or sets list of phrases and references that speech and language-priming systems should listen for.

Locale

Gets or sets a BCP-47 locale name for the contents of the text field.

LocalTimestamp

Gets or sets the date and time when the message was sent, in local time, expressed in ISO-8601 format. For example, 2016-09-23T13:07:49.4714686-07:00.

LocalTimezone

Gets or sets the name of the timezone used to define local time for the message, expressed in IANA Time Zone database format. For example, America/Los_Angeles.

MembersAdded

Gets or sets the collection of members added to the conversation.

MembersRemoved

Gets or sets the collection of members removed from the conversation.

Name

Gets or sets the name of the operation associated with an invoke or event activity.

Properties

Gets or sets properties that are not otherwise defined by the Activity type but that might appear in the serialized REST JSON object.

ReactionsAdded

Gets or sets the collection of reactions added to the conversation.

ReactionsRemoved

Gets or sets the collection of reactions removed from the conversation.

Recipient

Gets or sets the recipient of the message.

RelatesTo

Gets or sets a ConversationReference to another conversation or activity.

ReplyToId

Gets or sets the ID of the message to which this message is a reply.

SemanticAction

Gets or sets an optional programmatic action accompanying this request.

ServiceUrl

Gets or sets the URL that specifies the channel's service endpoint. Set by the channel.

Speak

Gets or sets the text to speak.

SuggestedActions

Gets or sets the suggested actions for the activity.

Summary

Gets or sets the text to display if the channel cannot render cards.

Text

Gets or sets the text content of the message.

TextFormat

Gets or sets the format of text fields. Default: markdown. Possible values are defined by TextFormatTypes.

TextHighlights

Gets or sets the collection of text fragments to highlight when the activity contains a ReplyToId value.

Timestamp

Gets or sets the date and time when the message was sent, in UTC, expressed in ISO-8601 format.

TopicName

Gets or sets the updated topic name of the conversation.

Type

Gets or sets the activity type. Possible values include: 'message', 'contactRelationUpdate', 'conversationUpdate', 'typing', 'endOfConversation', 'event', 'invoke', 'deleteUserData', 'messageUpdate', 'messageDelete', 'installationUpdate', 'messageReaction', 'suggestion', 'trace', 'handoff'.

Value

Gets or sets a value that is associated with the activity.

ValueType

Gets or sets the type of the activity's value object.

Methods

ApplyConversationReference(ConversationReference, Boolean)

Updates this activity with the delivery information from an existing ConversationReference.

AsCommandActivity()

Returns this activity as an ICommandActivity object; or null, if this is not that type of activity.

AsCommandResultActivity()

Returns this activity as an ICommandResultActivity object; or null, if this is not that type of activity.

AsContactRelationUpdateActivity()

Returns this activity as an IContactRelationUpdateActivity object; or null, if this is not that type of activity.

AsConversationUpdateActivity()

Returns this activity as an IConversationUpdateActivity object; or null, if this is not that type of activity.

AsEndOfConversationActivity()

Returns this activity as an IEndOfConversationActivity object; or null, if this is not that type of activity.

AsEventActivity()

Returns this activity as an IEventActivity object; or null, if this is not that type of activity.

AsHandoffActivity()

Returns this activity as an IHandoffActivity object; or null, if this is not that type of activity.

AsInstallationUpdateActivity()

Returns this activity as an IInstallationUpdateActivity object; or null, if this is not that type of activity.

AsInvokeActivity()

Returns this activity as an IInvokeActivity object; or null, if this is not that type of activity.

AsMessageActivity()

Returns this activity as an IMessageActivity object; or null, if this is not that type of activity.

AsMessageDeleteActivity()

Returns this activity as an IMessageDeleteActivity object; or null, if this is not that type of activity.

AsMessageReactionActivity()

Returns this activity as an IMessageReactionActivity object; or null, if this is not that type of activity.

AsMessageUpdateActivity()

Returns this activity as an IMessageUpdateActivity object; or null, if this is not that type of activity.

AsSuggestionActivity()

Returns this activity as an ISuggestionActivity object; or null, if this is not that type of activity.

AsTraceActivity()

Returns this activity as an ITraceActivity object; or null, if this is not that type of activity.

AsTypingActivity()

Returns this activity as an ITypingActivity object; or null, if this is not that type of activity.

CreateContactRelationUpdateActivity()

Creates an instance of the Activity class as an IContactRelationUpdateActivity object.

CreateConversationUpdateActivity()

Creates an instance of the Activity class as an IConversationUpdateActivity object.

CreateEndOfConversationActivity()

Creates an instance of the Activity class as an IEndOfConversationActivity object.

CreateEventActivity()

Creates an instance of the Activity class as an IEventActivity object.

CreateHandoffActivity()

Creates an instance of the Activity class as an IHandoffActivity object.

CreateInvokeActivity()

Creates an instance of the Activity class as an IInvokeActivity object.

CreateMessageActivity()

Creates an instance of the Activity class as an IMessageActivity object.

CreateReply(String, String)

Creates a new message activity as a response to this activity.

CreateTrace(String, Object, String, String)

Creates a new trace activity based on this activity.

CreateTraceActivity(String, String, Object, String)

Creates an instance of the Activity class as an ITraceActivity object.

CreateTypingActivity()

Creates an instance of the Activity class as an ITypingActivity object.

GetChannelData<TypeT>()

Gets the channel data for this activity as a strongly-typed object.

GetConversationReference()

Creates a ConversationReference based on this activity.

GetMentions()

Resolves the mentions from the entities of this activity.

GetReplyConversationReference(ResourceResponse)

Create a ConversationReference based on this Activity's Conversation info and the ResourceResponse from sending an activity.

HasContent()

Indicates whether this activity has content.

IsActivity(String)

Indicates whether this activity is of a specified activity type.

IsFromStreamingConnection()

Determine if the Activity was sent via an Http/Https connection or Streaming This can be determined by looking at the ServiceUrl property: (1) All channels that send messages via http/https are not streaming (2) Channels that send messages via streaming have a ServiceUrl that does not begin with http/https.

TryGetChannelData<TypeT>(TypeT)

Gets the channel data for this activity as a strongly-typed object. A return value idicates whether the operation succeeded.

Extension Methods

TeamsGetChannelId(IActivity)

Gets the Team's channel id from the current activity.

TeamsGetMeetingInfo(IActivity)

Gets the TeamsMeetingInfo object from the current activity.

TeamsGetSelectedChannelId(IActivity)

Gets the Team's selected channel id from the current activity.

TeamsGetTeamInfo(IActivity)

Gets the TeamsInfo object from the current activity.

TeamsGetTeamOnBehalfOf(IActivity)

Gets the Teams OnBehalfOf list from the current activity.

TeamsNotifyUser(IActivity, Boolean, String)

Configures the current activity to generate a notification within Teams.

TeamsNotifyUser(IActivity)

Configures the current activity to generate a notification within Teams.

MentionsId(IMessageActivity, String)

Is there a mention of Id in the Text Property.

MentionsRecipient(IMessageActivity)

Is there a mention of Recipient.Id in the Text Property.

RemoveMentionText(IMessageActivity, String)

Remove any mention text for given id from the Activity.Text property. For example, given the message @echoBot Hi Bot, this will remove "@echoBot", leaving "Hi Bot".

RemoveRecipientMention(IMessageActivity)

Remove recipient mention text from Text property. Use with caution because this function is altering the text on the Activity.

GetLocale(IActivity)

Gets the locale for the activity.

SetLocale(IActivity, String)

Sets the locale for the activity.

Applies to