Activity Activity Class

Definition

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

public class Activity : Microsoft.Bot.Connector.IContactRelationUpdateActivity, Microsoft.Bot.Connector.IConversationUpdateActivity, Microsoft.Bot.Connector.IEndOfConversationActivity, Microsoft.Bot.Connector.IEventActivity, Microsoft.Bot.Connector.IInstallationUpdateActivity, Microsoft.Bot.Connector.IInvokeActivity, Microsoft.Bot.Connector.IMessageActivity, Microsoft.Bot.Connector.ITypingActivity
Public Class Activity
Implements IContactRelationUpdateActivity, IConversationUpdateActivity, IEndOfConversationActivity, IEventActivity, IInstallationUpdateActivity, IInvokeActivity, IMessageActivity, ITypingActivity
Inheritance
ActivityActivity
Implements

Remarks

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

Constructors

Activity() Activity()

Initializes a new instance of the Activity class.

Activity(String, String, Nullable<DateTime>, Nullable<DateTime>, 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, Object, String, ConversationReference, String) Activity(String, String, Nullable<DateTime>, Nullable<DateTime>, 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, Object, String, ConversationReference, String)

Initializes a new instance of the Activity class.

Fields

ContentType ContentType

Content-type for an Activity

Properties

Action Action

ContactAdded/Removed action

AttachmentLayout AttachmentLayout

Hint for how to deal with multiple attachments: [list|carousel] Default:list

Attachments Attachments

Attachments

ChannelData ChannelData

Channel-specific payload

ChannelId ChannelId

ID of the channel where the activity was sent

Code Code

Code indicating why the conversation has ended

Conversation Conversation

Conversation

Entities Entities

Collection of Entity objects, each of which contains metadata about this activity. Each Entity object is typed.

From From

Sender address

HistoryDisclosed HistoryDisclosed

True if prior history of the channel is disclosed

Id Id

ID of this activity

InputHint InputHint

Indicates whether the bot is accepting, expecting, or ignoring input

Locale Locale

The language code of the Text field

LocalTimestamp LocalTimestamp

Local time when message was sent (set by client, Ex: 2016-09-23T13:07:49.4714686-07:00)

MembersAdded MembersAdded

Members added to the conversation

MembersRemoved MembersRemoved

Members removed from the conversation

Name Name

Name of the operation to invoke or the name of the event

Properties Properties

Extension data for overflow of properties

ReactionsAdded ReactionsAdded

Reactions added to the activity

ReactionsRemoved ReactionsRemoved

Reactions removed from the activity

Recipient Recipient

(Outbound to bot only) Bot's address that received the message

RelatesTo RelatesTo

Reference to another conversation or activity

ReplyToId ReplyToId

The original ID this message is a response to

ServiceUrl ServiceUrl

Service endpoint where operations concerning the activity may be performed

Speak Speak

SSML Speak for TTS audio response

SuggestedActions SuggestedActions

SuggestedActions are used to provide keyboard/quickreply like behavior in many clients

Summary Summary

Text to display if the channel cannot render cards

Text Text

Content for the message

TextFormat TextFormat

Format of text fields [plain|markdown] Default:markdown

Timestamp Timestamp

UTC Time when message was sent (set by service)

TopicName TopicName

The conversation's updated topic name

Type Type

The type of the activity [message|contactRelationUpdate|converationUpdate|typing|endOfConversation|event|invoke]

Value Value

Open-ended value

Methods

AsContactRelationUpdateActivity() AsContactRelationUpdateActivity()

Return an IContactRelationUpdateActivity mask if this is a contact relation update activity

AsConversationUpdateActivity() AsConversationUpdateActivity()

Return an IConversationUpdateActivity mask if this is a conversation update activity

AsEndOfConversationActivity() AsEndOfConversationActivity()

Return an IEndOfConversationActivity mask if this is an end of conversation activity

AsEventActivity() AsEventActivity()

Return an IEventActivity mask if this is an event activity

AsInstallationUpdateActivity() AsInstallationUpdateActivity()

Return an IInstallationUpdateActivity mask if this is a installation update activity

AsInvokeActivity() AsInvokeActivity()

Return an IInvokeActivity mask if this is an invoke activity

AsMessageActivity() AsMessageActivity()

Return an IMessageActivity mask if this is a message activity

AsTypingActivity() AsTypingActivity()

Return an ITypingActivity mask if this is a typing activity

CreateContactRelationUpdateActivity() CreateContactRelationUpdateActivity()

Create an instance of the Activity class with IContactRelationUpdateActivity masking

CreateConversationUpdateActivity() CreateConversationUpdateActivity()

Create an instance of the Activity class with IConversationUpdateActivity masking

CreateEndOfConversationActivity() CreateEndOfConversationActivity()

Create an instance of the Activity class with IEndOfConversationActivity masking

CreateEventActivity() CreateEventActivity()

Create an instance of the Activity class with an IEventActivity masking

CreateInvokeActivity() CreateInvokeActivity()

Create an instance of the Activity class with IInvokeActivity masking

CreateMessageActivity() CreateMessageActivity()

Create an instance of the Activity class with IMessageActivity masking

CreatePingActivity() CreatePingActivity()

Create an instance of the Activity class with IActivity masking

CreateReply(String, String) CreateReply(String, String)

Take a message and create a reply message for it with the routing information set up to correctly route a reply to the source message

CreateTypingActivity() CreateTypingActivity()

Create an instance of the Activity class with ITypingActivity masking

GetActivityType(String) GetActivityType(String)

Maps type to activity types

GetMentions() GetMentions()

Resolves the mentions from the entities of this (message) activity.

HasContent() HasContent()

Checks if this (message) activity has content.

IsActivity(String) IsActivity(String)

True if the Activity is of the specified activity type

Extension Methods

GetActivityType(IActivity) GetActivityType(IActivity)

Return the "major" portion of the activity

GetChannelData<TypeT>(IActivity) GetChannelData<TypeT>(IActivity)

Get channeldata as typed structure

GetStateClient(IActivity, MicrosoftAppCredentials, String, DelegatingHandler[]) GetStateClient(IActivity, MicrosoftAppCredentials, String, DelegatingHandler[])

Get StateClient appropriate for this activity

GetStateClient(IActivity, String, String, String, DelegatingHandler[]) GetStateClient(IActivity, String, String, String, DelegatingHandler[])

Get StateClient appropriate for this activity

MentionsId(IMessageActivity, String) MentionsId(IMessageActivity, String)

Is there a mention of Id in the Text Property

MentionsRecipient(IMessageActivity) MentionsRecipient(IMessageActivity)

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

RemoveMentionText(IMessageActivity, String) RemoveMentionText(IMessageActivity, String)

Replace any mention text for given id from Text property

RemoveRecipientMention(IMessageActivity) RemoveRecipientMention(IMessageActivity)

Remove recipient mention text from Text property

TryGetChannelData<TypeT>(IActivity, TypeT) TryGetChannelData<TypeT>(IActivity, TypeT)

Get channeldata as typed structure

Applies to