Microsoft.Bot.Connector.Activity Class Reference

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

Inheritance diagram for Microsoft.Bot.Connector.Activity:

Public Member Functions

 Activity ()
 Initializes a new instance of the Activity class. More...
 
 Activity (string type=default(string), string id=default(string), DateTime?timestamp=default(DateTime?), DateTime?localTimestamp=default(DateTime?), string serviceUrl=default(string), string channelId=default(string), ChannelAccount from=default(ChannelAccount), ConversationAccount conversation=default(ConversationAccount), ChannelAccount recipient=default(ChannelAccount), string textFormat=default(string), string attachmentLayout=default(string), IList< ChannelAccount > membersAdded=default(IList< ChannelAccount >), IList< ChannelAccount > membersRemoved=default(IList< ChannelAccount >), string topicName=default(string), bool?historyDisclosed=default(bool?), string locale=default(string), string text=default(string), string speak=default(string), string inputHint=default(string), string summary=default(string), SuggestedActions suggestedActions=default(SuggestedActions), IList< Attachment > attachments=default(IList< Attachment >), IList< Entity > entities=default(IList< Entity >), object channelData=default(object), string action=default(string), string replyToId=default(string), object value=default(object), string name=default(string), ConversationReference relatesTo=default(ConversationReference), string code=default(string))
 Initializes a new instance of the Activity class. More...
 
IContactRelationUpdateActivity AsContactRelationUpdateActivity ()
 Return an IContactRelationUpdateActivity mask if this is a contact relation update activity More...
 
IConversationUpdateActivity AsConversationUpdateActivity ()
 Return an IConversationUpdateActivity mask if this is a conversation update activity More...
 
IEndOfConversationActivity AsEndOfConversationActivity ()
 Return an IEndOfConversationActivity mask if this is an end of conversation activity More...
 
IEventActivity AsEventActivity ()
 Return an IEventActivity mask if this is an event activity More...
 
IInstallationUpdateActivity AsInstallationUpdateActivity ()
 Return an IInstallationUpdateActivity mask if this is a installation update activity More...
 
IInvokeActivity AsInvokeActivity ()
 Return an IInvokeActivity mask if this is an invoke activity More...
 
IMessageActivity AsMessageActivity ()
 Return an IMessageActivity mask if this is a message activity More...
 
ITypingActivity AsTypingActivity ()
 Return an ITypingActivity mask if this is a typing activity More...
 
Activity CreateReply (string text=null, string locale=null)
 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 More...
 
string GetActivityType ()
 Return the "major" portion of the activity More...
 
TypeT GetChannelData< TypeT > ()
 Get channeldata as typed structure More...
 
Mention[] GetMentions ()
 Get mentions More...
 
StateClient GetStateClient (MicrosoftAppCredentials credentials, string serviceUrl=null, params DelegatingHandler[] handlers)
 Get StateClient appropriate for this activity More...
 
StateClient GetStateClient (string microsoftAppId=null, string microsoftAppPassword=null, string serviceUrl=null, params DelegatingHandler[] handlers)
 Get StateClient appropriate for this activity More...
 
bool HasContent ()
 Check if the message has content More...
 
bool MentionsId (string id)
 Is there a mention of Id in the Text Property More...
 
bool MentionsRecipient ()
 Is there a mention of Recipient.Id in the Text Property More...
 
string RemoveMentionText (string id)
 Replace any mention text for given id from Text property More...
 
string RemoveRecipientMention ()
 Remove recipient mention text from Text property More...
 

Static Public Member Functions

static IContactRelationUpdateActivity CreateContactRelationUpdateActivity ()
 Create an instance of the Activity class with IContactRelationUpdateActivity masking More...
 
static IConversationUpdateActivity CreateConversationUpdateActivity ()
 Create an instance of the Activity class with IConversationUpdateActivity masking More...
 
static IEndOfConversationActivity CreateEndOfConversationActivity ()
 Create an instance of the Activity class with IEndOfConversationActivity masking More...
 
static IEventActivity CreateEventActivity ()
 Create an instance of the Activity class with an IEventActivity masking More...
 
static IInvokeActivity CreateInvokeActivity ()
 Create an instance of the Activity class with IInvokeActivity masking More...
 
static IMessageActivity CreateMessageActivity ()
 Create an instance of the Activity class with IMessageActivity masking More...
 
static IActivity CreatePingActivity ()
 Create an instance of the Activity class with IActivity masking More...
 
static ITypingActivity CreateTypingActivity ()
 Create an instance of the Activity class with ITypingActivity masking More...
 
static string GetActivityType (string type)
 

Public Attributes

const string ContentType = "application/vnd.microsoft.activity"
 Content-type for an Activity More...
 

Protected Member Functions

bool IsActivity (string activity)
 True if the Activity is of the specified activity type More...
 

Properties

string Action [get, set]
 ContactAdded/Removed action More...
 
string AttachmentLayout [get, set]
 Hint for how to deal with multiple attachments: [list|carousel] Default:list More...
 
IList< AttachmentAttachments [get, set]
 Attachments More...
 
object ChannelData [get, set]
 Channel-specific payload More...
 
string ChannelId [get, set]
 ID of the channel where the activity was sent More...
 
string Code [get, set]
 Code indicating why the conversation has ended More...
 
ConversationAccount Conversation [get, set]
 Conversation More...
 
IList< EntityEntities [get, set]
 Collection of Entity objects, each of which contains metadata about this activity. Each Entity object is typed. More...
 
ChannelAccount From [get, set]
 Sender address More...
 
bool HistoryDisclosed [get, set]
 True if the previous history of the channel is disclosed More...
 
string Id [get, set]
 ID of this activity More...
 
string InputHint [get, set]
 Indicates whether the bot is accepting, expecting, or ignoring input More...
 
string Locale [get, set]
 The language code of the Text field More...
 
DateTimeOffset LocalTimestamp [get, set]
 Local time when message was sent (set by client, Ex: 2016-09-23T13:07:49.4714686-07:00) More...
 
IList< ChannelAccountMembersAdded [get, set]
 Array of address added More...
 
IList< ChannelAccountMembersRemoved [get, set]
 Array of addresses removed More...
 
string Name [get, set]
 Name of the operation to invoke or the name of the event More...
 
JObject Properties [get, set]
 Extension data for overflow of properties More...
 
ChannelAccount Recipient [get, set]
 (Outbound to bot only) Bot's address that received the message More...
 
ConversationReference RelatesTo [get, set]
 Reference to another conversation or activity More...
 
string ReplyToId [get, set]
 The original ID this message is a response to More...
 
string ServiceUrl [get, set]
 Service endpoint where operations concerning the activity may be performed More...
 
string Speak [get, set]
 SSML Speak for TTS audio response More...
 
SuggestedActions SuggestedActions [get, set]
 SuggestedActions are used to provide keyboard/quickreply like behavior in many clients More...
 
string Summary [get, set]
 Text to display if the channel cannot render cards More...
 
string Text [get, set]
 Content for the message More...
 
string TextFormat [get, set]
 Format of text fields [plain|markdown] Default:markdown More...
 
DateTime Timestamp [get, set]
 UTC Time when message was sent (set by service) More...
 
string TopicName [get, set]
 Conversations new topic name More...
 
string Type [get, set]
 The type of the activity [message|contactRelationUpdate|converationUpdate|typing|endOfConversation|event|invoke] More...
 
object Value [get, set]
 Open-ended value More...
 

Detailed Description

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

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

Definition at line 18 of file ActivityEx.cs.

Constructor & Destructor Documentation

Microsoft.Bot.Connector.Activity.Activity ( )
inline

Initializes a new instance of the Activity class.

Definition at line 23 of file Activity.cs.

Microsoft.Bot.Connector.Activity.Activity ( string  type = default(string),
string  id = default(string),
DateTime?  timestamp = default(DateTime?),
DateTime?  localTimestamp = default(DateTime?),
string  serviceUrl = default(string),
string  channelId = default(string),
ChannelAccount  from = default(ChannelAccount),
ConversationAccount  conversation = default(ConversationAccount),
ChannelAccount  recipient = default(ChannelAccount),
string  textFormat = default(string),
string  attachmentLayout = default(string),
IList< ChannelAccount membersAdded = default(IList<ChannelAccount>),
IList< ChannelAccount membersRemoved = default(IList<ChannelAccount>),
string  topicName = default(string),
bool?  historyDisclosed = default(bool?),
string  locale = default(string),
string  text = default(string),
string  speak = default(string),
string  inputHint = default(string),
string  summary = default(string),
SuggestedActions  suggestedActions = default(SuggestedActions),
IList< Attachment attachments = default(IList<Attachment>),
IList< Entity entities = default(IList<Entity>),
object  channelData = default(object),
string  action = default(string),
string  replyToId = default(string),
object  value = default(object),
string  name = default(string),
ConversationReference  relatesTo = default(ConversationReference),
string  code = default(string) 
)
inline

Initializes a new instance of the Activity class.

Definition at line 28 of file Activity.cs.

Member Function Documentation

IContactRelationUpdateActivity Microsoft.Bot.Connector.Activity.AsContactRelationUpdateActivity ( )
inline

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

Implements Microsoft.Bot.Connector.IActivity.

Definition at line 119 of file ActivityEx.cs.

IConversationUpdateActivity Microsoft.Bot.Connector.Activity.AsConversationUpdateActivity ( )
inline

Return an IConversationUpdateActivity mask if this is a conversation update activity

Implements Microsoft.Bot.Connector.IActivity.

Definition at line 129 of file ActivityEx.cs.

IEndOfConversationActivity Microsoft.Bot.Connector.Activity.AsEndOfConversationActivity ( )
inline

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

Implements Microsoft.Bot.Connector.IActivity.

Definition at line 139 of file ActivityEx.cs.

IEventActivity Microsoft.Bot.Connector.Activity.AsEventActivity ( )
inline

Return an IEventActivity mask if this is an event activity

Implements Microsoft.Bot.Connector.IActivity.

Definition at line 144 of file ActivityEx.cs.

IInstallationUpdateActivity Microsoft.Bot.Connector.Activity.AsInstallationUpdateActivity ( )
inline

Return an IInstallationUpdateActivity mask if this is a installation update activity

Implements Microsoft.Bot.Connector.IActivity.

Definition at line 124 of file ActivityEx.cs.

IInvokeActivity Microsoft.Bot.Connector.Activity.AsInvokeActivity ( )
inline

Return an IInvokeActivity mask if this is an invoke activity

Implements Microsoft.Bot.Connector.IActivity.

Definition at line 149 of file ActivityEx.cs.

IMessageActivity Microsoft.Bot.Connector.Activity.AsMessageActivity ( )
inline

Return an IMessageActivity mask if this is a message activity

Implements Microsoft.Bot.Connector.IActivity.

Definition at line 114 of file ActivityEx.cs.

ITypingActivity Microsoft.Bot.Connector.Activity.AsTypingActivity ( )
inline

Return an ITypingActivity mask if this is a typing activity

Implements Microsoft.Bot.Connector.IActivity.

Definition at line 134 of file ActivityEx.cs.

static IContactRelationUpdateActivity Microsoft.Bot.Connector.Activity.CreateContactRelationUpdateActivity ( )
inlinestatic

Create an instance of the Activity class with IContactRelationUpdateActivity masking

Definition at line 74 of file ActivityEx.cs.

static IConversationUpdateActivity Microsoft.Bot.Connector.Activity.CreateConversationUpdateActivity ( )
inlinestatic

Create an instance of the Activity class with IConversationUpdateActivity masking

Definition at line 79 of file ActivityEx.cs.

static IEndOfConversationActivity Microsoft.Bot.Connector.Activity.CreateEndOfConversationActivity ( )
inlinestatic

Create an instance of the Activity class with IEndOfConversationActivity masking

Definition at line 94 of file ActivityEx.cs.

static IEventActivity Microsoft.Bot.Connector.Activity.CreateEventActivity ( )
inlinestatic

Create an instance of the Activity class with an IEventActivity masking

Definition at line 99 of file ActivityEx.cs.

static IInvokeActivity Microsoft.Bot.Connector.Activity.CreateInvokeActivity ( )
inlinestatic

Create an instance of the Activity class with IInvokeActivity masking

Definition at line 104 of file ActivityEx.cs.

static IMessageActivity Microsoft.Bot.Connector.Activity.CreateMessageActivity ( )
inlinestatic

Create an instance of the Activity class with IMessageActivity masking

Definition at line 69 of file ActivityEx.cs.

static IActivity Microsoft.Bot.Connector.Activity.CreatePingActivity ( )
inlinestatic

Create an instance of the Activity class with IActivity masking

Definition at line 89 of file ActivityEx.cs.

Activity Microsoft.Bot.Connector.Activity.CreateReply ( string  text = null,
string  locale = null 
)
inline

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

Parameters
texttext you want to reply with
localelanguage of your reply
Returns
message set up to route back to the sender

Definition at line 41 of file ActivityEx.cs.

static ITypingActivity Microsoft.Bot.Connector.Activity.CreateTypingActivity ( )
inlinestatic

Create an instance of the Activity class with ITypingActivity masking

Definition at line 84 of file ActivityEx.cs.

string Microsoft.Bot.Connector.Activity.GetActivityType ( )
inline

Return the "major" portion of the activity

Returns
normalized major portion of the activity, aka message/... will return "message"

Definition at line 271 of file ActivityEx.cs.

static string Microsoft.Bot.Connector.Activity.GetActivityType ( string  type)
inlinestatic

Definition at line 277 of file ActivityEx.cs.

TypeT Microsoft.Bot.Connector.Activity.GetChannelData< TypeT > ( )
inline

Get channeldata as typed structure

Template Parameters
TypeTtype to use
Returns
typed object or default(TypeT)

Implements Microsoft.Bot.Connector.IMessageActivity.

Definition at line 260 of file ActivityEx.cs.

Mention [] Microsoft.Bot.Connector.Activity.GetMentions ( )
inline

Get mentions

Returns

Implements Microsoft.Bot.Connector.IMessageActivity.

Definition at line 208 of file ActivityEx.cs.

StateClient Microsoft.Bot.Connector.Activity.GetStateClient ( MicrosoftAppCredentials  credentials,
string  serviceUrl = null,
params DelegatingHandler[]  handlers 
)
inline

Get StateClient appropriate for this activity

Parameters
credentialscredentials for bot to access state api
serviceUrlalternate serviceurl to use for state service
handlers
Returns

Definition at line 158 of file ActivityEx.cs.

StateClient Microsoft.Bot.Connector.Activity.GetStateClient ( string  microsoftAppId = null,
string  microsoftAppPassword = null,
string  serviceUrl = null,
params DelegatingHandler[]  handlers 
)
inline

Get StateClient appropriate for this activity

Parameters
microsoftAppId
microsoftAppPassword
serviceUrlalternate serviceurl to use for state service
handlers
Returns

Definition at line 178 of file ActivityEx.cs.

bool Microsoft.Bot.Connector.Activity.HasContent ( )
inline

Check if the message has content

Returns
Returns true if this message has any content to send

Implements Microsoft.Bot.Connector.IMessageActivity.

Definition at line 187 of file ActivityEx.cs.

bool Microsoft.Bot.Connector.Activity.IsActivity ( string  activity)
inlineprotected

True if the Activity is of the specified activity type

Definition at line 109 of file ActivityEx.cs.

bool Microsoft.Bot.Connector.Activity.MentionsId ( string  id)
inline

Is there a mention of Id in the Text Property

Parameters
idChannelAccount.Id
Returns
true if this id is mentioned in the text

Definition at line 218 of file ActivityEx.cs.

bool Microsoft.Bot.Connector.Activity.MentionsRecipient ( )
inline

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

Returns
true if this id is mentioned in the text

Definition at line 227 of file ActivityEx.cs.

string Microsoft.Bot.Connector.Activity.RemoveMentionText ( string  id)
inline

Replace any mention text for given id from Text property

Parameters
idid to match
Returns
new .Text property value

Definition at line 246 of file ActivityEx.cs.

string Microsoft.Bot.Connector.Activity.RemoveRecipientMention ( )
inline

Remove recipient mention text from Text property

Returns
new .Text property value

Definition at line 236 of file ActivityEx.cs.

Member Data Documentation

const string Microsoft.Bot.Connector.Activity.ContentType = "application/vnd.microsoft.activity"

Content-type for an Activity

Definition at line 32 of file ActivityEx.cs.

Property Documentation

string Microsoft.Bot.Connector.Activity.Action
getset

ContactAdded/Removed action

Definition at line 217 of file Activity.cs.

string Microsoft.Bot.Connector.Activity.AttachmentLayout
getset

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

Definition at line 130 of file Activity.cs.

IList<Attachment> Microsoft.Bot.Connector.Activity.Attachments
getset

Attachments

Definition at line 198 of file Activity.cs.

object Microsoft.Bot.Connector.Activity.ChannelData
getset

Channel-specific payload

Definition at line 211 of file Activity.cs.

string Microsoft.Bot.Connector.Activity.ChannelId
getset

ID of the channel where the activity was sent

Definition at line 99 of file Activity.cs.

string Microsoft.Bot.Connector.Activity.Code
getset

Code indicating why the conversation has ended

Definition at line 247 of file Activity.cs.

ConversationAccount Microsoft.Bot.Connector.Activity.Conversation
getset

Conversation

Definition at line 111 of file Activity.cs.

IList<Entity> Microsoft.Bot.Connector.Activity.Entities
getset

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

Definition at line 205 of file Activity.cs.

ChannelAccount Microsoft.Bot.Connector.Activity.From
getset

Sender address

Definition at line 105 of file Activity.cs.

bool Microsoft.Bot.Connector.Activity.HistoryDisclosed
getset

True if the previous history of the channel is disclosed

Definition at line 154 of file Activity.cs.

string Microsoft.Bot.Connector.Activity.Id
getset

ID of this activity

Definition at line 73 of file Activity.cs.

string Microsoft.Bot.Connector.Activity.InputHint
getset

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

Definition at line 179 of file Activity.cs.

string Microsoft.Bot.Connector.Activity.Locale
getset

The language code of the Text field

Definition at line 160 of file Activity.cs.

DateTimeOffset Microsoft.Bot.Connector.Activity.LocalTimestamp
getset

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

Definition at line 86 of file Activity.cs.

IList<ChannelAccount> Microsoft.Bot.Connector.Activity.MembersAdded
getset

Array of address added

Definition at line 136 of file Activity.cs.

IList<ChannelAccount> Microsoft.Bot.Connector.Activity.MembersRemoved
getset

Array of addresses removed

Definition at line 142 of file Activity.cs.

string Microsoft.Bot.Connector.Activity.Name
getset

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

Definition at line 235 of file Activity.cs.

JObject Microsoft.Bot.Connector.Activity.Properties
getset

Extension data for overflow of properties

Definition at line 63 of file ActivityEx.cs.

ChannelAccount Microsoft.Bot.Connector.Activity.Recipient
getset

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

Definition at line 117 of file Activity.cs.

ConversationReference Microsoft.Bot.Connector.Activity.RelatesTo
getset

Reference to another conversation or activity

Definition at line 241 of file Activity.cs.

string Microsoft.Bot.Connector.Activity.ReplyToId
getset

The original ID this message is a response to

Definition at line 223 of file Activity.cs.

string Microsoft.Bot.Connector.Activity.ServiceUrl
getset

Service endpoint where operations concerning the activity may be performed

Definition at line 93 of file Activity.cs.

string Microsoft.Bot.Connector.Activity.Speak
getset

SSML Speak for TTS audio response

Definition at line 172 of file Activity.cs.

SuggestedActions Microsoft.Bot.Connector.Activity.SuggestedActions
getset

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

Definition at line 192 of file Activity.cs.

string Microsoft.Bot.Connector.Activity.Summary
getset

Text to display if the channel cannot render cards

Definition at line 185 of file Activity.cs.

string Microsoft.Bot.Connector.Activity.Text
getset

Content for the message

Definition at line 166 of file Activity.cs.

string Microsoft.Bot.Connector.Activity.TextFormat
getset

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

Definition at line 123 of file Activity.cs.

DateTime Microsoft.Bot.Connector.Activity.Timestamp
getset

UTC Time when message was sent (set by service)

Definition at line 79 of file Activity.cs.

string Microsoft.Bot.Connector.Activity.TopicName
getset

Conversations new topic name

Definition at line 148 of file Activity.cs.

string Microsoft.Bot.Connector.Activity.Type
getset

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

Definition at line 67 of file Activity.cs.

object Microsoft.Bot.Connector.Activity.Value
getset

Open-ended value

Definition at line 229 of file Activity.cs.


The documentation for this class was generated from the following files: