Activity Class
An Activity is the basic communication type for the protocol.
Constructor
pydantic model Activity
Parameters
| Name | Description |
|---|---|
|
type
Required
|
str or
ActivityTypes
Contains the activity type. Possible values include: 'message', 'contactRelationUpdate', 'conversationUpdate', 'typing', 'endOfConversation', 'event', 'invoke', 'deleteUserData', 'messageUpdate', 'messageDelete', 'installationUpdate', 'messageReaction', 'suggestion', 'trace', 'handoff' |
|
id
Required
|
Contains an ID that uniquely identifies the activity on the channel. |
|
timestamp
Required
|
Contains the date and time that the message was sent, in UTC, expressed in ISO-8601 format. |
|
local_timestamp
Required
|
Contains the local date and time of the message expressed in ISO-8601 format. For example, 2016-09-23T13:07:49.4714686-07:00. |
|
local_timezone
Required
|
Contains the name of the local timezone of the message, expressed in IANA Time Zone database format. For example, America/Los_Angeles. |
|
service_url
Required
|
Contains the URL that specifies the channel's service endpoint. Set by the channel. |
|
channel_id
Required
|
Contains an ID that uniquely identifies the channel (and possibly the sub-channel). Set by the channel. |
|
from_property
Required
|
Identifies the sender of the message. |
|
conversation
Required
|
Identifies the conversation to which the activity belongs. |
|
recipient
Required
|
Identifies the recipient of the message. |
|
text_format
Required
|
Format of text fields Default:markdown. Possible values include: 'markdown', 'plain', 'xml' |
|
attachment_layout
Required
|
The layout hint for multiple attachments. Default: list. Possible values include: 'list', 'carousel' |
|
members_added
Required
|
The collection of members added to the conversation. |
|
members_removed
Required
|
The collection of members removed from the conversation. |
|
reactions_added
Required
|
The collection of reactions added to the conversation. |
|
reactions_removed
Required
|
The collection of reactions removed from the conversation. |
|
topic_name
Required
|
The updated topic name of the conversation. |
|
history_disclosed
Required
|
Indicates whether the prior history of the channel is disclosed. |
|
locale
Required
|
A locale name for the contents of the text field. The locale name is a combination of an ISO 639 two- or three-letter culture code associated with a language and an ISO 3166 two-letter subculture code associated with a country or region. The locale name can also correspond to a valid BCP-47 language tag. |
|
text
Required
|
The text content of the message. |
|
speak
Required
|
The text to speak. |
|
input_hint
Required
|
str or
InputHints
Indicates whether your agent is accepting, expecting, or ignoring user input after the message is delivered to the client. Possible values include: 'acceptingInput', 'ignoringInput', 'expectingInput' |
|
summary
Required
|
The text to display if the channel cannot render cards. |
|
suggested_actions
Required
|
The suggested actions for the activity. |
|
attachments
Required
|
Attachments |
|
entities
Required
|
Represents the entities that were mentioned in the message. |
|
channel_data
Required
|
Contains channel-specific content. |
|
action
Required
|
Indicates whether the recipient of a contactRelationUpdate was added or removed from the sender's contact list. |
|
reply_to_id
Required
|
Contains the ID of the message to which this message is a reply. |
|
label
Required
|
A descriptive label for the activity. |
|
value_type
Required
|
The type of the activity's value object. |
|
value
Required
|
A value that is associated with the activity. |
|
name
Required
|
The name of the operation associated with an invoke or event activity. |
|
relates_to
Required
|
A reference to another conversation or activity. |
|
code
Required
|
The a code for endOfConversation activities that indicates why the conversation ended. Possible values include: 'unknown', 'completedSuccessfully', 'userCancelled', 'botTimedOut', 'botIssuedInvalidMessage', 'channelFailed' |
|
expiration
Required
|
The time at which the activity should be considered to be "expired" and should not be presented to the recipient. |
|
importance
Required
|
The importance of the activity. Possible values include: 'low', 'normal', 'high' |
|
delivery_mode
Required
|
str or
DeliveryModes
A delivery hint to signal to the recipient alternate delivery paths for the activity. The default delivery mode is "default". Possible values include: 'normal', 'notification', 'expectReplies', 'ephemeral' |
|
listen_for
Required
|
List of phrases and references that speech and language priming systems should listen for |
|
text_highlights
Required
|
The collection of text fragments to highlight when the activity contains a ReplyToId value. |
|
semantic_action
Required
|
An optional programmatic action accompanying this request |
|
caller_id
Required
|
A string containing an IRI identifying the caller of an agent. This field is not intended to be transmitted over the wire, but is instead populated by agents and clients based on cryptographically verifiable data that asserts the identity of the callers (e.g. tokens). |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
type
Required
|
|
|
channelId
|
Default value: None
|
|
id
|
Default value: None
|
|
timestamp
|
Default value: None
|
|
localTimestamp
|
Default value: None
|
|
localTimezone
|
Default value: None
|
|
serviceUrl
|
Default value: None
|
|
from_property
|
Default value: None
|
|
conversation
|
Default value: None
|
|
recipient
|
Default value: None
|
|
textFormat
|
Default value: None
|
|
attachmentLayout
|
Default value: None
|
|
membersAdded
|
Default value: None
|
|
membersRemoved
|
Default value: None
|
|
reactionsAdded
|
Default value: None
|
|
reactionsRemoved
|
Default value: None
|
|
topicName
|
Default value: None
|
|
historyDisclosed
|
Default value: None
|
|
locale
|
Default value: None
|
|
text
|
Default value: None
|
|
speak
|
Default value: None
|
|
inputHint
|
Default value: None
|
|
summary
|
Default value: None
|
|
suggestedActions
|
Default value: None
|
|
attachments
|
Default value: None
|
|
entities
|
Default value: None
|
|
channelData
|
Default value: None
|
|
action
|
Default value: None
|
|
replyToId
|
Default value: None
|
|
label
|
Default value: None
|
|
valueType
|
Default value: None
|
|
value
|
Default value: None
|
|
name
|
Default value: None
|
|
relatesTo
|
Default value: None
|
|
code
|
Default value: None
|
|
expiration
|
Default value: None
|
|
importance
|
Default value: None
|
|
deliveryMode
|
Default value: None
|
|
listenFor
|
Default value: None
|
|
textHighlights
|
Default value: None
|
|
semanticAction
|
Default value: None
|
|
callerId
|
Default value: None
|
|
requestId
|
Default value: None
|
Methods
| add_ai_metadata |
Adds AI entity to an activity to indicate AI-generated content. |
| add_attachment |
Adds one or more attachments to the activity. |
| add_entity |
Adds one or more entities to the activity. |
| add_mention |
Adds a mention of the given account to the activity. |
| add_text |
Appends text to the existing text content of the activity. |
| apply_conversation_reference |
Updates this activity with the delivery information from an existing ConversationReference. |
| as_contact_relation_update_activity |
Returns this activity as a ContactRelationUpdateActivity object; or None, if this is not that type of activity. |
| as_conversation_update_activity |
Returns this activity as a ConversationUpdateActivity object; or None, if this is not that type of activity. |
| as_end_of_conversation_activity |
Returns this activity as an EndOfConversationActivity object; or None, if this is not that type of activity. |
| as_event_activity |
Returns this activity as an EventActivity object; or None, if this is not that type of activity. |
| as_handoff_activity |
Returns this activity as a HandoffActivity object; or None, if this is not that type of activity. |
| as_installation_update_activity |
Returns this activity as an InstallationUpdateActivity object; or None, if this is not that type of activity. |
| as_invoke_activity |
Returns this activity as an InvokeActivity object; or None, if this is not that type of activity. |
| as_message_activity |
Returns this activity as a MessageActivity object; or None, if this is not that type of activity. |
| as_message_delete_activity |
Returns this activity as a MessageDeleteActivity object; or None, if this is not that type of activity. |
| as_message_reaction_activity |
Returns this activity as a MessageReactionActivity object; or None, if this is not that type of activity. |
| as_message_update_activity |
Returns this activity as an MessageUpdateActivity object; or None, if this is not that type of activity. |
| as_suggestion_activity |
Returns this activity as a SuggestionActivity object; or None, if this is not that type of activity. |
| as_trace_activity |
Returns this activity as a TraceActivity object; or None, if this is not that type of activity. |
| as_typing_activity |
Returns this activity as a TypingActivity object; or null, if this is not that type of activity. |
| create_contact_relation_update_activity |
Creates an instance of the Activity class as a ContactRelationUpdateActivity object. |
| create_conversation_update_activity |
Creates an instance of the Activity class as a ConversationUpdateActivity object. |
| create_end_of_conversation_activity |
Creates an instance of the Activity class as an EndOfConversationActivity object. |
| create_event_activity |
Creates an instance of the Activity class as an EventActivity object. |
| create_handoff_activity |
Creates an instance of the Activity class as a HandoffActivity object. |
| create_invoke_activity |
Creates an instance of the Activity class as an InvokeActivity object. |
| create_message_activity |
Creates an instance of the Activity class as a MessageActivity object. |
| create_reply |
Creates a new message activity as a response to this activity. |
| create_trace |
Creates a new trace activity based on this activity. |
| create_trace_activity |
Creates an instance of the Activity class as a TraceActivity object. |
| create_typing_activity |
Creates an instance of the Activity class as a TypingActivity object. |
| get_account_mention |
Resolves the mention for the given account id, if any. |
| get_agentic_instance_id |
Gets the agent instance ID from the context if it's an agentic request. |
| get_agentic_tenant_id |
Gets the agentic tenant ID from the context if it's an agentic request. |
| get_agentic_user |
Gets the agentic user (agenticUserId) from the context if it's an agentic request. |
| get_conversation_reference |
Creates a ConversationReference based on this activity. |
| get_mentions |
Resolves the mentions from the entities of this activity. |
| get_product_info_entity |
Get the product info entity from the activity's entities. |
| get_reply_conversation_reference |
Create a ConversationReference based on this Activity's Conversation info and the ResourceResponse from sending an activity. |
| has_content |
Indicates whether this activity has content. |
| is_agentic_request | |
| is_command |
Indicates whether this activity is a command activity. |
| is_command_result |
Indicates whether this activity is a command result activity. |
| is_conversation_update |
Indicates whether this activity is a conversation update activity. |
| is_end_of_conversation |
Indicates whether this activity is an end of conversation activity. |
| is_event |
Indicates whether this activity is an event activity. |
| is_from_streaming_connection |
Determine if the Activity was sent via an Http/Https connection or Streaming. This can be determined by looking at the service_url 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. |
| is_handoff |
Indicates whether this activity is a handoff activity. |
| is_invoke |
Indicates whether this activity is an invoke activity. |
| is_message |
Indicates whether this activity is a message activity. |
| is_recipient_mentioned |
Indicates whether the recipient of this activity was mentioned. |
| is_targeted_activity |
Indicates whether this activity is targeted. |
| is_trace |
Indicates whether this activity is a trace activity. |
| is_typing |
Indicates whether this activity is a typing activity. |
| make_targeted_activity |
Marks this activity as targeted, setting the recipient if provided. |
| remove_mention_text |
Removes the mention text for the given account id from the activity's text. For example, given the message <at>echoAgent</at> Hi Agent, this removes <at>echoAgent</at>, leaving Hi Agent. |
| remove_recipient_mention |
Removes the recipient's mention text from the activity's text. |
| with_attachment_layout |
Sets the attachment layout hint for the activity. |
| with_delivery_mode |
Sets the delivery mode of the activity. |
| with_input_hint |
Sets the input hint for the activity. |
| with_locale |
Sets the locale of the activity. |
| with_name |
Sets the name of the activity. |
| with_recipient |
Sets the recipient of the activity. |
| with_speak |
Sets the text to speak for the activity. |
| with_suggested_actions |
Sets the suggested actions for the activity. |
| with_summary |
Sets the summary of the activity. |
| with_targeted_recipient |
Make an activity targeted. |
| with_text |
Sets the text content of the activity. |
| with_text_format |
Sets the text format of the activity. |
| with_value |
Sets the value of the activity, and optionally its value type. |
add_ai_metadata
Adds AI entity to an activity to indicate AI-generated content.
add_ai_metadata(citations: list[ClientCitation] | None = None, usage_info: SensitivityUsageInfo | None = None) -> None
Parameters
| Name | Description |
|---|---|
|
activity
Required
|
The activity to modify |
|
citations
|
Optional list of citations Default value: None
|
|
usage_info
|
Optional sensitivity usage information Default value: None
|
Returns
| Type | Description |
|---|---|
add_attachment
Adds one or more attachments to the activity.
add_attachment(*attachments: Attachment) -> Self
Parameters
| Name | Description |
|---|---|
|
attachments
Required
|
The attachments to add to the activity. |
Returns
| Type | Description |
|---|---|
|
This activity, to allow for method chaining. |
add_entity
add_mention
Adds a mention of the given account to the activity.
add_mention(account: ChannelAccount, text: str | None = None, add_text: bool = True) -> Self
Parameters
| Name | Description |
|---|---|
|
account
Required
|
The account to mention. |
|
text
|
The text of the mention. Defaults to the account's name. Default value: None
|
|
add_text
|
Whether to prepend the mention markup to the activity's text. Default value: True
|
Returns
| Type | Description |
|---|---|
|
This activity, to allow for method chaining. |
add_text
apply_conversation_reference
Updates this activity with the delivery information from an existing ConversationReference.
apply_conversation_reference(reference: ConversationReference, is_incoming: bool = False) -> Self
Parameters
| Name | Description |
|---|---|
|
reference
Required
|
The existing conversation reference. |
|
is_incoming
|
Optional, True to treat the activity as an incoming activity, where the agent is the recipient; otherwise, False. Default is False, and the activity will show the agent as the sender. Default value: False
|
Returns
| Type | Description |
|---|---|
|
This activity, updated with the delivery information. |
Remarks
Call get_conversation_reference on an incoming activity to get a conversation reference that you can then use to update an outgoing activity with the correct delivery information.
as_contact_relation_update_activity
Returns this activity as a ContactRelationUpdateActivity object; or None, if this is not that type of activity.
as_contact_relation_update_activity()
Returns
| Type | Description |
|---|---|
|
This activity as a message activity; or None. |
as_conversation_update_activity
Returns this activity as a ConversationUpdateActivity object; or None, if this is not that type of activity.
as_conversation_update_activity()
Returns
| Type | Description |
|---|---|
|
This activity as a conversation update activity; or None. |
as_end_of_conversation_activity
Returns this activity as an EndOfConversationActivity object; or None, if this is not that type of activity.
as_end_of_conversation_activity()
Returns
| Type | Description |
|---|---|
|
This activity as an end of conversation activity; or None. |
as_event_activity
Returns this activity as an EventActivity object; or None, if this is not that type of activity.
as_event_activity()
Returns
| Type | Description |
|---|---|
|
This activity as an event activity; or None. |
as_handoff_activity
Returns this activity as a HandoffActivity object; or None, if this is not that type of activity.
as_handoff_activity()
Returns
| Type | Description |
|---|---|
|
This activity as a handoff activity; or None. |
as_installation_update_activity
Returns this activity as an InstallationUpdateActivity object; or None, if this is not that type of activity.
as_installation_update_activity()
Returns
| Type | Description |
|---|---|
|
This activity as an installation update activity; or None. |
as_invoke_activity
Returns this activity as an InvokeActivity object; or None, if this is not that type of activity.
as_invoke_activity()
Returns
| Type | Description |
|---|---|
|
This activity as an invoke activity; or None. |
as_message_activity
Returns this activity as a MessageActivity object; or None, if this is not that type of activity.
as_message_activity()
Returns
| Type | Description |
|---|---|
|
This activity as a message activity; or None. |
as_message_delete_activity
Returns this activity as a MessageDeleteActivity object; or None, if this is not that type of activity.
as_message_delete_activity()
Returns
| Type | Description |
|---|---|
|
This activity as a message delete request; or None. |
as_message_reaction_activity
Returns this activity as a MessageReactionActivity object; or None, if this is not that type of activity.
as_message_reaction_activity()
Returns
| Type | Description |
|---|---|
|
This activity as a message reaction activity; or None. |
as_message_update_activity
Returns this activity as an MessageUpdateActivity object; or None, if this is not that type of activity.
as_message_update_activity()
Returns
| Type | Description |
|---|---|
|
This activity as a message update request; or None. |
as_suggestion_activity
Returns this activity as a SuggestionActivity object; or None, if this is not that type of activity.
as_suggestion_activity()
Returns
| Type | Description |
|---|---|
|
This activity as a suggestion activity; or None. |
as_trace_activity
Returns this activity as a TraceActivity object; or None, if this is not that type of activity.
as_trace_activity()
Returns
| Type | Description |
|---|---|
|
This activity as a trace activity; or None. |
as_typing_activity
Returns this activity as a TypingActivity object; or null, if this is not that type of activity.
as_typing_activity()
Returns
| Type | Description |
|---|---|
|
This activity as a typing activity; or null. |
create_contact_relation_update_activity
Creates an instance of the Activity class as a ContactRelationUpdateActivity object.
static create_contact_relation_update_activity()
Returns
| Type | Description |
|---|---|
|
The new contact relation update activity. |
create_conversation_update_activity
Creates an instance of the Activity class as a ConversationUpdateActivity object.
static create_conversation_update_activity()
Returns
| Type | Description |
|---|---|
|
The new conversation update activity. |
create_end_of_conversation_activity
Creates an instance of the Activity class as an EndOfConversationActivity object.
static create_end_of_conversation_activity()
Returns
| Type | Description |
|---|---|
|
The new end of conversation activity. |
create_event_activity
Creates an instance of the Activity class as an EventActivity object.
static create_event_activity()
Returns
| Type | Description |
|---|---|
|
The new event activity. |
create_handoff_activity
Creates an instance of the Activity class as a HandoffActivity object.
static create_handoff_activity()
Returns
| Type | Description |
|---|---|
|
The new handoff activity. |
create_invoke_activity
Creates an instance of the Activity class as an InvokeActivity object.
static create_invoke_activity()
Returns
| Type | Description |
|---|---|
|
The new invoke activity. |
create_message_activity
Creates an instance of the Activity class as a MessageActivity object.
static create_message_activity()
Returns
| Type | Description |
|---|---|
|
The new message activity. |
create_reply
Creates a new message activity as a response to this activity.
create_reply(text: str | None = None, locale: str | None = None) -> Activity
Parameters
| Name | Description |
|---|---|
|
text
|
The text of the reply. Default value: None
|
|
locale
|
The language code for the text. Default value: None
|
Returns
| Type | Description |
|---|---|
|
The new message activity. |
Remarks
The new activity sets up routing information based on this activity.
create_trace
Creates a new trace activity based on this activity.
create_trace(name: str, value: object = None, value_type: str | None = None, label: str | None = None)
Parameters
| Name | Description |
|---|---|
|
name
Required
|
The name of the trace operation to create. |
|
value
|
Optional, the content for this trace operation. Default value: None
|
|
value_type
|
Optional, identifier for the format of the value. Default is the name of type of the value. Default value: None
|
|
label
|
Optional, a descriptive label for this trace operation. Default value: None
|
Returns
| Type | Description |
|---|---|
|
The new trace activity. |
create_trace_activity
Creates an instance of the Activity class as a TraceActivity object.
static create_trace_activity(name: str, value: object = None, value_type: str | None = None, label: str | None = None) -> Activity
Parameters
| Name | Description |
|---|---|
|
name
Required
|
The name of the trace operation to create. |
|
value
|
Optional, the content for this trace operation. Default value: None
|
|
value_type
|
Optional, identifier for the format of the value. Default is the name of type of the value. Default value: None
|
|
label
|
Optional, a descriptive label for this trace operation. Default value: None
|
Returns
| Type | Description |
|---|---|
|
The new trace activity. |
create_typing_activity
get_account_mention
get_agentic_instance_id
get_agentic_tenant_id
get_agentic_user
get_conversation_reference
Creates a ConversationReference based on this activity.
get_conversation_reference(force_base_channel: bool | None = None) -> ConversationReference
Parameters
| Name | Description |
|---|---|
|
force_base_channel
|
Optional, when True use only the base channel value
from the channel id (for example Default value: None
|
Returns
| Type | Description |
|---|---|
|
A conversation reference for the conversation that contains this activity. |
get_mentions
Resolves the mentions from the entities of this activity.
get_mentions() -> list[Mention]
Returns
| Type | Description |
|---|---|
|
The array of mentions; or an empty array, if none are found. |
Remarks
This method is defined on the Activity class, but is only intended for use with a message activity, where the activity Activity.Type is set to ActivityTypes.Message.
get_product_info_entity
Get the product info entity from the activity's entities.
get_product_info_entity() -> ProductInfo | None
Returns
| Type | Description |
|---|---|
|
The product info entity, or None if not found. |
get_reply_conversation_reference
Create a ConversationReference based on this Activity's Conversation info and the ResourceResponse from sending an activity.
get_reply_conversation_reference(reply: ResourceResponse) -> ConversationReference
Parameters
| Name | Description |
|---|---|
|
reply
Required
|
ResourceResponse returned from send_activity. |
Returns
| Type | Description |
|---|---|
|
A ConversationReference that can be stored and used later to delete or update the activity. |
has_content
Indicates whether this activity has content.
has_content() -> bool
Returns
| Type | Description |
|---|---|
|
True, if this activity has any content to send; otherwise, false. |
Remarks
This method is defined on the Activity class, but is only intended for use with a message activity, where the activity Activity.Type is set to ActivityTypes.Message.
is_agentic_request
is_command
Indicates whether this activity is a command activity.
is_command() -> bool
Returns
| Type | Description |
|---|---|
|
True if this activity is a command activity; otherwise, False. |
is_command_result
Indicates whether this activity is a command result activity.
is_command_result() -> bool
Returns
| Type | Description |
|---|---|
|
True if this activity is a command result activity; otherwise, False. |
is_conversation_update
Indicates whether this activity is a conversation update activity.
is_conversation_update() -> bool
Returns
| Type | Description |
|---|---|
|
True if this activity is a conversation update activity; otherwise, False. |
is_end_of_conversation
Indicates whether this activity is an end of conversation activity.
is_end_of_conversation() -> bool
Returns
| Type | Description |
|---|---|
|
True if this activity is an end of conversation activity; otherwise, False. |
is_event
Indicates whether this activity is an event activity.
is_event() -> bool
Returns
| Type | Description |
|---|---|
|
True if this activity is an event activity; otherwise, False. |
is_from_streaming_connection
Determine if the Activity was sent via an Http/Https connection or Streaming. This can be determined by looking at the service_url 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.
is_from_streaming_connection() -> bool
Returns
| Type | Description |
|---|---|
|
True if the Activity originated from a streaming connection. |
is_handoff
Indicates whether this activity is a handoff activity.
is_handoff() -> bool
Returns
| Type | Description |
|---|---|
|
True if this activity is a handoff activity; otherwise, False. |
is_invoke
Indicates whether this activity is an invoke activity.
is_invoke() -> bool
Returns
| Type | Description |
|---|---|
|
True if this activity is an invoke activity; otherwise, False. |
is_message
Indicates whether this activity is a message activity.
is_message() -> bool
Returns
| Type | Description |
|---|---|
|
True if this activity is a message activity; otherwise, False. |
is_recipient_mentioned
Indicates whether the recipient of this activity was mentioned.
is_recipient_mentioned() -> bool
Returns
| Type | Description |
|---|---|
|
True if the recipient was mentioned; otherwise, False. |
is_targeted_activity
Indicates whether this activity is targeted.
is_targeted_activity() -> bool
Returns
| Type | Description |
|---|---|
|
True if this activity carries a targeted treatment; otherwise, False. |
is_trace
Indicates whether this activity is a trace activity.
is_trace() -> bool
Returns
| Type | Description |
|---|---|
|
True if this activity is a trace activity; otherwise, False. |
is_typing
Indicates whether this activity is a typing activity.
is_typing() -> bool
Returns
| Type | Description |
|---|---|
|
True if this activity is a typing activity; otherwise, False. |
make_targeted_activity
Marks this activity as targeted, setting the recipient if provided.
make_targeted_activity(user: ChannelAccount | None = None) -> Self
Parameters
| Name | Description |
|---|---|
|
user
|
The account to target. Defaults to the current recipient. Default value: None
|
Returns
| Type | Description |
|---|---|
|
This activity, to allow for method chaining. |
Exceptions
| Type | Description |
|---|---|
|
If both the activity's recipient and the user argument are None. |
remove_mention_text
Removes the mention text for the given account id from the activity's text.
For example, given the message <at>echoAgent</at> Hi Agent, this removes <at>echoAgent</at>, leaving Hi Agent.
remove_mention_text(identifier: str | None) -> str
Parameters
| Name | Description |
|---|---|
|
identifier
Required
|
The id of the account whose mention text should be removed. |
Returns
| Type | Description |
|---|---|
|
The updated activity text. |
Remarks
The format of a mention entity is dependent on the channel, but in all cases the Mention.text is expected to contain the exact text for the user as it appears in Activity.text.
remove_recipient_mention
Removes the recipient's mention text from the activity's text.
remove_recipient_mention() -> str
Returns
| Type | Description |
|---|---|
|
The updated activity text. |
Remarks
This method is defined on the Activity class, but is only intended for use with a message activity, where the activity Activity.Type is set to ActivityTypes.Message.
with_attachment_layout
Sets the attachment layout hint for the activity.
with_attachment_layout(attachment_layout: str) -> Self
Parameters
| Name | Description |
|---|---|
|
attachment_layout
Required
|
The layout hint for multiple attachments. Possible values include: 'list', 'carousel'. |
Returns
| Type | Description |
|---|---|
|
This activity, to allow for method chaining. |
with_delivery_mode
with_input_hint
with_locale
with_name
with_recipient
Sets the recipient of the activity.
with_recipient(recipient: str | ChannelAccount) -> Self
Parameters
| Name | Description |
|---|---|
|
recipient
Required
|
The recipient of the activity. Can be an id or a ChannelAccount instance. |
Returns
| Type | Description |
|---|---|
|
This activity, to allow for method chaining. |
with_speak
with_suggested_actions
Sets the suggested actions for the activity.
with_suggested_actions(suggested_actions: SuggestedActions) -> Self
Parameters
| Name | Description |
|---|---|
|
suggested_actions
Required
|
The suggested actions for the activity. |
Returns
| Type | Description |
|---|---|
|
This activity, to allow for method chaining. |
with_summary
with_targeted_recipient
Make an activity targeted.
with_targeted_recipient(recipient: str | ChannelAccount) -> Self
Parameters
| Name | Description |
|---|---|
|
recipient
Required
|
The recipient to target the activity to. Can be a string or a ChannelAccount instance. |
Returns
| Type | Description |
|---|---|
|
This activity, to allow for method chaining. |
with_text
with_text_format
with_value
Sets the value of the activity, and optionally its value type.
with_value(value: object, value_type: str | None = None) -> Self
Parameters
| Name | Description |
|---|---|
|
value
Required
|
A value that is associated with the activity. |
|
value_type
|
The type of the activity's value object. Only set when provided. Default value: None
|
Returns
| Type | Description |
|---|---|
|
This activity, to allow for method chaining. |
Attributes
action
field action: NonEmptyString = None
attachment_layout
field attachment_layout: NonEmptyString = None (alias 'attachmentLayout')
attachments
field attachments: list[Attachment] = None
caller_id
field caller_id: NonEmptyString = None (alias 'callerId')
channel_data
field channel_data: object = None (alias 'channelData')
channel_id
field channel_id: ChannelId | None = None (alias 'channelId')
code
field code: NonEmptyString = None
conversation
field conversation: ConversationAccount = None
delivery_mode
field delivery_mode: NonEmptyString = None (alias 'deliveryMode')
entities
field entities: list[SerializeAsAny[Entity]] = None
expiration
field expiration: datetime = None
from_property
field from_property: Annotated[ChannelAccount, Field(alias='from')] = None (alias 'from')
history_disclosed
field history_disclosed: bool = None (alias 'historyDisclosed')
id
field id: NonEmptyString | None = None
importance
field importance: NonEmptyString = None
input_hint
field input_hint: NonEmptyString = None (alias 'inputHint')
label
field label: NonEmptyString = None
listen_for
field listen_for: list[NonEmptyString] = None (alias 'listenFor')
local_timestamp
field local_timestamp: datetime = None (alias 'localTimestamp')
local_timezone
field local_timezone: NonEmptyString = None (alias 'localTimezone')
locale
field locale: NonEmptyString = None
members_added
field members_added: list[ChannelAccount] = None (alias 'membersAdded')
members_removed
field members_removed: list[ChannelAccount] = None (alias 'membersRemoved')
name
field name: NonEmptyString = None
reactions_added
field reactions_added: list[MessageReaction] = None (alias 'reactionsAdded')
reactions_removed
field reactions_removed: list[MessageReaction] = None (alias 'reactionsRemoved')
recipient
field recipient: ChannelAccount | None = None
relates_to
field relates_to: ConversationReference = None (alias 'relatesTo')
reply_to_id
field reply_to_id: NonEmptyString = None (alias 'replyToId')
request_id
field request_id: Annotated[str | None, Field(exclude=True)] = None (alias 'requestId')
semantic_action
field semantic_action: SemanticAction = None (alias 'semanticAction')
service_url
field service_url: NonEmptyString = None (alias 'serviceUrl')
speak
field speak: str = None
suggested_actions
field suggested_actions: SuggestedActions = None (alias 'suggestedActions')
summary
field summary: NonEmptyString = None
text
field text: str | None = None
text_format
field text_format: NonEmptyString = None (alias 'textFormat')
text_highlights
field text_highlights: list[TextHighlight] = None (alias 'textHighlights')
timestamp
field timestamp: datetime = None
topic_name
field topic_name: NonEmptyString = None (alias 'topicName')
type
field type: NonEmptyString [Required]
value
field value: object = None
value_type
field value_type: NonEmptyString = None (alias 'valueType')