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
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<DateTime>, Nullable<DateTime>, String, String, ChannelAccount, ConversationAccount, ChannelAccount, String, String, IList<ChannelAccount>, IList<ChannelAccount>, 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

Content-type for an Activity

Properties

Action

ContactAdded/Removed action

AttachmentLayout

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

Attachments

Attachments

ChannelData

Channel-specific payload

ChannelId

ID of the channel where the activity was sent

Code

Code indicating why the conversation has ended

Conversation

Conversation

Entities

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

From

Sender address

HistoryDisclosed

True if the previous history of the channel is disclosed

Id

ID of this activity

InputHint

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

Locale

The language code of the Text field

LocalTimestamp

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

MembersAdded

Array of address added

MembersRemoved

Array of addresses removed

Name

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

Properties

Extension data for overflow of properties

Recipient

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

RelatesTo

Reference to another conversation or activity

ReplyToId

The original ID this message is a response to

ServiceUrl

Service endpoint where operations concerning the activity may be performed

Speak

SSML Speak for TTS audio response

SuggestedActions

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

Summary

Text to display if the channel cannot render cards

Text

Content for the message

TextFormat

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

Timestamp

UTC Time when message was sent (set by service)

TopicName

Conversations new topic name

Type

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

Value

Open-ended value

Methods

AsContactRelationUpdateActivity()

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

AsConversationUpdateActivity()

Return an IConversationUpdateActivity mask if this is a conversation update activity

AsEndOfConversationActivity()

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

AsEventActivity()

Return an IEventActivity mask if this is an event activity

AsInstallationUpdateActivity()

Return an IInstallationUpdateActivity mask if this is a installation update activity

AsInvokeActivity()

Return an IInvokeActivity mask if this is an invoke activity

AsMessageActivity()

Return an IMessageActivity mask if this is a message activity

AsTypingActivity()

Return an ITypingActivity mask if this is a typing activity

CreateContactRelationUpdateActivity()

Create an instance of the Activity class with IContactRelationUpdateActivity masking

CreateConversationUpdateActivity()

Create an instance of the Activity class with IConversationUpdateActivity masking

CreateEndOfConversationActivity()

Create an instance of the Activity class with IEndOfConversationActivity masking

CreateEventActivity()

Create an instance of the Activity class with an IEventActivity masking

CreateInvokeActivity()

Create an instance of the Activity class with IInvokeActivity masking

CreateMessageActivity()

Create an instance of the Activity class with IMessageActivity masking

CreatePingActivity()

Create an instance of the Activity class with IActivity masking

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()

Create an instance of the Activity class with ITypingActivity masking

GetActivityType(String)

Maps type to activity types

GetMentions()
HasContent()
IsActivity(String)

True if the Activity is of the specified activity type

Extension Methods

ToConversationReference(IActivity)
AddHeroCard<T>(IMessageActivity, String, IEnumerable<T>, IEnumerable<String>)
AddKeyboardCard<T>(IMessageActivity, String, IEnumerable<T>, IEnumerable<String>)
GetActivityType(IActivity)
GetChannelData<TypeT>(IActivity)
GetMentions(IMessageActivity)
GetStateClient(IActivity, MicrosoftAppCredentials, String, DelegatingHandler[])
GetStateClient(IActivity, String, String, String, DelegatingHandler[])
HasContent(IMessageActivity)
MentionsId(IMessageActivity, String)
MentionsRecipient(IMessageActivity)
RemoveMentionText(IMessageActivity, String)
RemoveRecipientMention(IMessageActivity)
TryGetChannelData<TypeT>(IActivity, TypeT)