Activity Class

  • java.lang.Object
    • com.microsoft.bot.schema.Activity

public class Activity

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

Constructor Summary

Modifier Constructor Description
protected Activity()

Default constructor.

Activity(String withType)

Construct an Activity of the specified type.

Method Summary

Modifier and Type Method and Description
TypeT <TypeT>getChannelData(Class<TypeT> classType)

Get channelData as typed structure.

ResultPair<TypeT> <TypeT>tryGetChannelData(Class<TypeT> clsType)

Get channelData as typed structure.

final Activity applyConversationReference(ConversationReference reference)

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

final Activity applyConversationReference(ConversationReference reference, boolean isIncoming)

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

static Activity clone(Activity activity)

Clone a activity.

static Activity createContactRelationUpdateActivity()

Create a CONTACT_RELATION_UPDATE type Activity.

static Activity createConversationUpdateActivity()

Create a CONVERSATION_UPDATE type Activity.

static Activity createEndOfConversationActivity()

Creates a END_OF_CONVERSATION type of Activity.

static Activity createEventActivity()

Creates a EVENT type of Activity.

static Activity createHandoffActivity()

Creates a HANDOFF type Activity.

static Activity createInvokeActivity()

Creates a INVOKE type of Activity.

static Activity createMessageActivity()

Create a MESSAGE type Activity.

Activity createReply()

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

Activity createReply(String withText)

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

Activity createReply(String withText, String withLocale)

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

Activity createTrace(String withName)

Creates an instance of the Activity class as type TRACE.

Activity createTrace(String withName, Object withValue, String withValueType, String withLabel)

Creates an instance of the Activity class as type TRACE.

static Activity createTraceActivity(String withName)

Create a TRACE type Activity.

static Activity createTraceActivity(String withName, String withValueType, Object withValue, String withLabel)

Create a TRACE type Activity.

static Activity createTypingActivity()

Creates a TYPING type Activity.

java.lang.String getAction()

Indicates whether the recipient of a contactRelationUpdate was added or removed from the sender's contact list.

AttachmentLayoutTypes getAttachmentLayout()

The layout hint for multiple attachments.

java.util.List<Attachment> getAttachments()

Gets the attachments to the Activity.

java.lang.String getCallerId()

Gets a string containing an IRI identifying the caller of a bot.

java.lang.Object getChannelData()

Gets channel-specific content.

java.lang.String getChannelId()

Gets the ID that uniquely identifies the channel.

EndOfConversationCodes getCode()

Gets the a code for endOfConversation activities that indicates why the conversation ended.

ConversationAccount getConversation()

Identifies the conversation to which the activity belongs.

ConversationReference getConversationReference()

Creates a ConversationReference based on this activity.

java.lang.String getDeliveryMode()

A delivery hint to signal to the recipient alternate delivery paths for the activity.

java.util.List<Entity> getEntities()

Returns payload version of the Entities in an Activity.

java.time.LocalDateTime getExpiration()

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

ChannelAccount getFrom()

Identifies the sender of the message.

boolean getHistoryDisclosed()

Gets whether the prior history of the channel is disclosed.

java.lang.String getId()

Returns the ID that uniquely identifies the activity on the channel.

java.lang.String getImportance()

Gets the importance of the activity.

InputHints getInputHint()

Indicates whether your bot is accepting, expecting, or ignoring user input after the message is delivered to the client.

java.lang.String getLabel()

Gets the descriptive label for the activity.

java.util.List<java.lang.String> getListenFor()

Gets the list of phrases and references that speech and language priming systems should listen for.

java.time.OffsetDateTime getLocalTimestamp()

Gets the local date and time of the message, expressed in ISO-8601 format.

java.lang.String getLocalTimezone()

Gets the name of the local timezone of the message, expressed in IANA Time Zone database format.

java.lang.String getLocale()

A locale name for the contents of the text field.

java.util.List<ChannelAccount> getMembersAdded()

Gets the collection of members added to the conversation.

java.util.List<ChannelAccount> getMembersRemoved()

Gets the collection of members removed from the conversation.

java.util.List<Mention> getMentions()

Resolves the mentions from the entities of this activity.

java.lang.String getName()

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

java.util.Map<java.lang.String,com.fasterxml.jackson.databind.JsonNode> getProperties()

Holds the overflow properties that aren't first class properties in the object.

java.util.List<MessageReaction> getReactionsAdded()

Gets the collection of reactions added to the conversation.

java.util.List<MessageReaction> getReactionsRemoved()

Gets the collection of reactions removed from the conversation.

ChannelAccount getRecipient()

Identifies the recipient of the message.

ConversationReference getRelatesTo()

A reference to another conversation or activity.

ConversationReference getReplyConversationReference(ResourceResponse reply)

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

java.lang.String getReplyToId()

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

java.lang.String getServiceUrl()

Sets the URL that specifies the channel's service endpoint.

java.lang.String getSpeak()

The text to speak.

SuggestedActions getSuggestedActions()

Gets the suggested actions for the activity.

java.lang.String getSummary()

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

java.lang.String getText()

Gets the text content of the message.

TextFormatTypes getTextFormat()

Format of text fields Default:markdown.

java.util.List<TextHighlight> getTextHighlights()

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

java.time.OffsetDateTime getTimestamp()

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

java.lang.String getTopicName()

Gets the updated topic name of the conversation.

java.lang.String getType()

Gets the ActivityTypes of the activity.

java.lang.Object getValue()

Gets the value that is associated with the activity.

java.lang.String getValueType()

Gets the type of the activity's value object.

boolean hasContent()

Checks if this (message) activity has content.

protected boolean isActivity(String activityType)

True if the Activity is of the specified activity type.

java.lang.Boolean isFromStreamingConnection()

Determines 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.

boolean isTeamsActivity()

Check if this actvity is from microsoft teams.

boolean isType(String compareTo)

Convenience method to return if the Activity is of the specified type.

java.lang.String removeMentionText(String withId)

Remove any mention text for given id from the Activity.Text property.

static java.lang.String removeMentionTextImmutable(Activity activity, String id)

Removes the mention from the Activity.Text without modifying the Activity.

java.lang.String removeRecipientMention()

Remove recipient mention text from Text property.

static java.lang.String removeRecipientMentionImmutable(Activity activity)

Removes recipient mention without modifying the Activity.

void setAction(String withAction)

Indicates whether the recipient of a contactRelationUpdate was added or removed from the sender's contact list.

void setAttachment(Attachment withAttachment)

Sets a single attachment on the Activity.

void setAttachmentLayout(AttachmentLayoutTypes withAttachmentLayout)

Sets the layout hint for multiple attachments.

void setAttachments(List<Attachment> withAttachments)

Sets the attachments to the Activity.

void setCallerId(String withCallerId)

Sets the IRI identifying the caller of a bot.

void setChannelData(Object withChannelData)

Sets channel-specific content.

void setChannelId(String withChannelId)

Sets the ID that uniquely identifies the channel.

void setCode(EndOfConversationCodes withCode)

Sets the a code for endOfConversation activities that indicates why the conversation ended.

void setConversation(ConversationAccount withConversation)

Identifies the conversation to which the activity belongs.

void setDeliveryMode(String withDeliveryMode)

A delivery hint to signal to the recipient alternate delivery paths for the activity.

void setEntities(List<Entity> withEntities)

Sets payload version of the Entities in an Activity.

void setExpiration(LocalDateTime withExpiration)

Sets the time at which the activity should be considered to be expired and should not be presented to the recipient.

void setFrom(ChannelAccount withFrom)

Identifies the sender of the message.

void setHistoryDisclosed(boolean withHistoryDisclosed)

Sets whether the prior history of the channel is disclosed.

void setId(String withId)

Sets the ID that uniquely identifies the activity on the channel.

void setImportance(String withImportance)

Sets the importance of the activity.

void setInputHint(InputHints withInputHint)

Indicates whether your bot is accepting, expecting, or ignoring user input after the message is delivered to the client.

void setLabel(String withLabel)

Sets the descriptive label for the activity.

void setListenFor(List<String> withListenFor)

Sets the list of phrases and references that speech and language priming systems should listen for.

void setLocalTimeZone(String withLocalTimezone)

Sets the name of the local timezone of the message, expressed in IANA Time Zone database format.

void setLocalTimestamp(OffsetDateTime withLocalTimestamp)

Contains the local date and time of the message, expressed in ISO-8601 format.

void setLocale(String withLocale)

A locale name for the contents of the text field.

void setMembersAdded(List<ChannelAccount> withMembersAdded)

Sets the collection of members added to the conversation.

void setMembersRemoved(List<ChannelAccount> withMembersRemoved)

Sets the collection of members removed from the conversation.

void setMentions(List<Mention> withMentions)

Sets payload version of the Mentions in an Activity.

void setName(String withName)

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

void setProperties(String key, JsonNode withValue)

Holds the overflow properties that aren't first class properties in the object.

void setReactionsAdded(List<MessageReaction> withReactionsAdded)

Sets the collection of reactions added to the conversation.

void setReactionsRemoved(List<MessageReaction> withReactionsRemoved)

Sets the collection of reactions removed from the conversation.

void setRecipient(ChannelAccount withRecipient)

Identifies the recipient of the message.

void setRelatesTo(ConversationReference withRelatesTo)

A reference to another conversation or activity.

void setReplyToId(String withReplyToId)

Sets the ID of the message to which this message is a reply.

void setServiceUrl(String withServiceUrl)

Sets the URL that specifies the channel's service endpoint.

void setSpeak(String withSpeak)

Sets the text to speak.

void setSuggestedActions(SuggestedActions withSuggestedActions)

The suggested actions for the activity.

void setSummary(String withSummary)

Sets the text to display if the channel cannot render cards.

void setText(String withText)

Sets the text content of the message.

void setTextFormat(TextFormatTypes withTextFormat)

Format of text fields.

void setTextHighlights(List<TextHighlight> withTextHighlights)

Sets the collection of text fragments to highlight when the activity contains a ReplyToId value.

void setTimestamp(OffsetDateTime withTimestamp)

Sets the date and time that the message was sent, in UTC, expressed in ISO-8601 format.

void setTopicName(String withTopicName)

Sets the updated topic name of the conversation.

void setType(String withType)

Sets the ActivityTypes of the activity.

void setValue(Object withValue)

Sets the value that is associated with the activity.

void setValueType(String withValueType)

Sets the type of the activity's value object.

TeamsChannelData teamsGetChannelData()

Gets the TeamsChannelData.

java.lang.String teamsGetChannelId()

Get unique identifier representing a channel.

TeamsMeetingInfo teamsGetMeetingInfo()

Gets the TeamsMeetingInfo object from the current activity.

java.lang.String teamsGetTeamId()

Get unique identifier representing a team.

TeamInfo teamsGetTeamInfo()

Get Teams TeamInfo data.

void teamsNotifyUser()

Sets the notification value in the TeamsChannelData to true.

void teamsNotifyUser(boolean alertInMeeting, String externalResourceUrl)

Sets the notification of a meeting in the TeamsChannelData.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

Activity

protected Activity()

Default constructor. Normally this wouldn't be used as the ActivityType is normally required.

Activity

public Activity(String withType)

Construct an Activity of the specified type.

Parameters:

withType - The activity type.

Method Details

<TypeT>getChannelData

public TypeT getChannelData(Class classType)

Get channelData as typed structure.

Parameters:

classType - Class of TypeT to use

Returns:

typed Object or default(TypeT)

Throws:

com.fasterxml.jackson.core.JsonProcessingException - If the channel data can't be converted to TypeT.

<TypeT>tryGetChannelData

public ResultPair tryGetChannelData(Class clsType)

Get channelData as typed structure.

Parameters:

clsType - Class of TypeT to use

Returns:

ChannelData as TypeT

applyConversationReference

public final Activity applyConversationReference(ConversationReference reference)

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

Parameters:

reference - The existing conversation reference.

Returns:

This activity, updated with the delivery information.

applyConversationReference

public final Activity applyConversationReference(ConversationReference reference, boolean isIncoming)

Updates this activity with the delivery information from an existing ConversationReference. Call #getConversationReference on an incoming activity to get a conversation reference that you can then use to update an outgoing activity with the correct delivery information.

Parameters:

reference - The existing conversation reference.
isIncoming - true to treat the activity as an incoming activity, where the bot is the recipient; otherwise, false.

Returns:

This activity, updated with the delivery information.

clone

public static Activity clone(Activity activity)

Clone a activity.

Parameters:

activity - The activity to clone.

Returns:

new cloned activity

createContactRelationUpdateActivity

public static Activity createContactRelationUpdateActivity()

Create a CONTACT_RELATION_UPDATE type Activity.

Returns:

A contact relation update type Activity.

createConversationUpdateActivity

public static Activity createConversationUpdateActivity()

Create a CONVERSATION_UPDATE type Activity.

Returns:

A conversation update type Activity.

createEndOfConversationActivity

public static Activity createEndOfConversationActivity()

Creates a END_OF_CONVERSATION type of Activity.

Returns:

The new end of conversation activity.

createEventActivity

public static Activity createEventActivity()

Creates a EVENT type of Activity.

Returns:

The new event activity.

createHandoffActivity

public static Activity createHandoffActivity()

Creates a HANDOFF type Activity.

Returns:

The new handoff activity.

createInvokeActivity

public static Activity createInvokeActivity()

Creates a INVOKE type of Activity.

Returns:

The new invoke activity.

createMessageActivity

public static Activity createMessageActivity()

Create a MESSAGE type Activity.

Returns:

A message Activity type.

createReply

public Activity createReply()

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

Returns:

The new message activity.

createReply

public Activity createReply(String withText)

Creates a new message activity as a response to this activity. This overload uses this Activity's Locale.

Parameters:

withText - The text of the reply.

Returns:

The new message activity.

createReply

public Activity createReply(String withText, String withLocale)

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

Parameters:

withText - The text of the reply.
withLocale - The language code for the text.

Returns:

The new message activity.

createTrace

public Activity createTrace(String withName)

Creates an instance of the Activity class as type TRACE.

Parameters:

withName - The name of the trace operation to create.

Returns:

The new trace activity.

createTrace

public Activity createTrace(String withName, Object withValue, String withValueType, String withLabel)

Creates an instance of the Activity class as type TRACE.

Parameters:

withName - The name of the trace operation to create.
withValue - Optional, the content for this trace operation.
withValueType - Optional, identifier for the format of withValue. Default is the name of type of the withValue.
withLabel - Optional, a descriptive label for this trace operation.

Returns:

The new trace activity.

createTraceActivity

public static Activity createTraceActivity(String withName)

Create a TRACE type Activity.

Parameters:

withName - Name of the operation

Returns:

A Trace type Activity.

createTraceActivity

public static Activity createTraceActivity(String withName, String withValueType, Object withValue, String withLabel)

Create a TRACE type Activity.

Parameters:

withName - Name of the operation
withValueType - valueType if helpful to identify the value schema (default is value.GetType().Name)
withValue - The content for this trace operation.
withLabel - A descriptive label for this trace operation.

Returns:

A Trace type Activity.

createTypingActivity

public static Activity createTypingActivity()

Creates a TYPING type Activity.

Returns:

The new typing activity.

getAction

public String getAction()

Indicates whether the recipient of a contactRelationUpdate was added or removed from the sender's contact list.

Returns:

Recipient action.

getAttachmentLayout

public AttachmentLayoutTypes getAttachmentLayout()

The layout hint for multiple attachments.

Returns:

The Attachment type.

getAttachments

public List getAttachments()

Gets the attachments to the Activity.

Returns:

A List of Attachment.

getCallerId

public String getCallerId()

Gets 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).

Returns:

The caller IRI.

getChannelData

public Object getChannelData()

Gets channel-specific content.

Returns:

Channel specific data.

getChannelId

public String getChannelId()

Gets the ID that uniquely identifies the channel. Set by the channel.

Returns:

The channel ID.

getCode

public EndOfConversationCodes getCode()

Gets the a code for endOfConversation activities that indicates why the conversation ended.

Returns:

The endOfConversation code.

getConversation

public ConversationAccount getConversation()

Identifies the conversation to which the activity belongs.

Returns:

getConversationReference

public ConversationReference getConversationReference()

Creates a ConversationReference based on this activity.

Returns:

A conversation reference for the conversation that contains this activity.

getDeliveryMode

public String getDeliveryMode()

A delivery hint to signal to the recipient alternate delivery paths for the activity.

The default delivery mode is \"default\". See DeliveryModes.

Returns:

The delivery mode hint.

getEntities

public List getEntities()

Returns payload version of the Entities in an Activity. Entities can vary in the number of fields. The Entity class holds the additional fields in getProperties(). To convert to other entity types, use <T>getAs(Class<T> classType).

Returns:

A List of Entity.

getExpiration

public LocalDateTime getExpiration()

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

Returns:

the activity expiration.

getFrom

public ChannelAccount getFrom()

Identifies the sender of the message.

Returns:

The ChannelAccount of the sender.

getHistoryDisclosed

public boolean getHistoryDisclosed()

Gets whether the prior history of the channel is disclosed.

Returns:

True if the history is disclosed.

getId

public String getId()

Returns the ID that uniquely identifies the activity on the channel.

Returns:

The activity id.

getImportance

public String getImportance()

Gets the importance of the activity.

Returns:

The activity importance.

getInputHint

public InputHints getInputHint()

Indicates whether your bot is accepting, expecting, or ignoring user input after the message is delivered to the client.

Returns:

The input hint for the activity.

getLabel

public String getLabel()

Gets the descriptive label for the activity.

Returns:

The activity label.

getListenFor

public List getListenFor()

Gets the list of phrases and references that speech and language priming systems should listen for.

Returns:

List of phrases to listen for.

getLocalTimestamp

public OffsetDateTime getLocalTimestamp()

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

Returns:

The local timestamp of the activity.

getLocalTimezone

public String getLocalTimezone()

Gets the name of the local timezone of the message, expressed in IANA Time Zone database format. For example, America/Los_Angeles.

Returns:

The local timezone.

getLocale

public String getLocale()

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.

Returns:

The content locale.

getMembersAdded

public List getMembersAdded()

Gets the collection of members added to the conversation.

Returns:

List of ChannelAccount of added members.

getMembersRemoved

public List getMembersRemoved()

Gets the collection of members removed from the conversation.

Returns:

List of ChannelAccount of removed members.

getMentions

public List getMentions()

Resolves the mentions from the entities of this activity. 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 MESSAGE.

Returns:

The array of mentions; or an empty array, if none are found.

getName

public String getName()

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

Returns:

The Activity name.

getProperties

public Map getProperties()

Holds the overflow properties that aren't first class properties in the object. This allows extensibility while maintaining the object.

Returns:

Map of additional properties.

getReactionsAdded

public List getReactionsAdded()

Gets the collection of reactions added to the conversation.

Returns:

A List of MessageReaction.

getReactionsRemoved

public List getReactionsRemoved()

Gets the collection of reactions removed from the conversation.

Returns:

A List of MessageReaction.

getRecipient

public ChannelAccount getRecipient()

Identifies the recipient of the message.

Returns:

The ChannelAccount of the recipient.

getRelatesTo

public ConversationReference getRelatesTo()

A reference to another conversation or activity.

Returns:

The conversation reference.

getReplyConversationReference

public ConversationReference getReplyConversationReference(ResourceResponse reply)

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

Parameters:

reply - ResourceResponse returned from sendActivity.

Returns:

A ConversationReference that can be stored and used later to delete or update the activity.

getReplyToId

public String getReplyToId()

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

Returns:

The reply to ID.

getServiceUrl

public String getServiceUrl()

Sets the URL that specifies the channel's service endpoint. Set by the channel.

Returns:

The service URL.

getSpeak

public String getSpeak()

The text to speak.

Returns:

The SSML text to speak.

getSuggestedActions

public SuggestedActions getSuggestedActions()

Gets the suggested actions for the activity.

Returns:

The SuggestedActions for the activity.

getSummary

public String getSummary()

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

Returns:

The summary text.

getText

public String getText()

Gets the text content of the message.

Returns:

The text content.

getTextFormat

public TextFormatTypes getTextFormat()

Format of text fields Default:markdown. Possible values include: 'markdown', 'plain', 'xml'.

Returns:

The TextFormatTypes type.

getTextHighlights

public List getTextHighlights()

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

Returns:

List of TextHighlight.

getTimestamp

public OffsetDateTime getTimestamp()

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

Returns:

The UTC timestamp of the activity.

getTopicName

public String getTopicName()

Gets the updated topic name of the conversation.

Returns:

The topic name.

getType

public String getType()

Gets the ActivityTypes of the activity.

Returns:

The Activity type.

getValue

public Object getValue()

Gets the value that is associated with the activity.

Returns:

The Activity value.

getValueType

public String getValueType()

Gets the type of the activity's value object.

Returns:

The value type.

hasContent

public boolean hasContent()

Checks if this (message) activity has content.

Returns:

Returns true, if this message has any content to send. False otherwise.

isActivity

protected boolean isActivity(String activityType)

True if the Activity is of the specified activity type.

Parameters:

activityType - The type to compare to.

Returns:

true if the activity is of the specific type.

isFromStreamingConnection

public Boolean isFromStreamingConnection()

Determines 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.

Returns:

True if the Activity was originate from a streaming connection.

isTeamsActivity

public boolean isTeamsActivity()

Check if this actvity is from microsoft teams.

Returns:

true if the activity is from microsoft teams.

isType

public boolean isType(String compareTo)

Convenience method to return if the Activity is of the specified type.

Parameters:

compareTo - The type to compare to.

Returns:

True if the Activity is of the specified type.

removeMentionText

public String removeMentionText(String withId)

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". Typically this would be used to remove the mention text for the target recipient (the bot usually), though it could be called for each member. For example: turnContext.Activity.RemoveMentionText(turnContext.Activity.Recipient.Id); The format of a mention Activity.Entity is dependent on the Channel. But in all cases we expect the Mention.Text to contain the exact text for the user as it appears in Activity.Text. For example, Teams uses <at>username</at>, whereas slack use @username. It is expected that text is in Activity.Text and this method will remove that value from Activity.Text.

Parameters:

withId - Mention id to match.

Returns:

new Activity.Text property value.

removeMentionTextImmutable

public static String removeMentionTextImmutable(Activity activity, String id)

Removes the mention from the Activity.Text without modifying the Activity.

Parameters:

activity - The Activity to remove mention text on.
id - The ID of the recipient.

Returns:

The Activity.Text with the mention removed.

removeRecipientMention

public String removeRecipientMention()

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

Returns:

new .Text property value.

removeRecipientMentionImmutable

public static String removeRecipientMentionImmutable(Activity activity)

Removes recipient mention without modifying the Activity.

Parameters:

activity - The Activity to remove mentions from.

Returns:

The Activity.Text with mentions removed.

setAction

public void setAction(String withAction)

Indicates whether the recipient of a contactRelationUpdate was added or removed from the sender's contact list.

Parameters:

withAction - Recipient action.

setAttachment

public void setAttachment(Attachment withAttachment)

Sets a single attachment on the Activity.

Parameters:

withAttachment - The Attachment object.

setAttachmentLayout

public void setAttachmentLayout(AttachmentLayoutTypes withAttachmentLayout)

Sets the layout hint for multiple attachments.

Parameters:

withAttachmentLayout - The attachment type.

setAttachments

public void setAttachments(List withAttachments)

Sets the attachments to the Activity.

Parameters:

withAttachments - A List of Attachment.

setCallerId

public void setCallerId(String withCallerId)

Sets the 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).

Parameters:

withCallerId - The caller id.

setChannelData

public void setChannelData(Object withChannelData)

Sets channel-specific content.

Parameters:

withChannelData - Channel specific data as a JsonNode.

setChannelId

public void setChannelId(String withChannelId)

Sets the ID that uniquely identifies the channel. Set by the channel.

Parameters:

withChannelId - The channel ID.

setCode

public void setCode(EndOfConversationCodes withCode)

Sets the a code for endOfConversation activities that indicates why the conversation ended.

Parameters:

withCode - The endOfConversation code.

setConversation

public void setConversation(ConversationAccount withConversation)

Identifies the conversation to which the activity belongs.

Parameters:

withConversation - The ConversationAccount.

setDeliveryMode

public void setDeliveryMode(String withDeliveryMode)

A delivery hint to signal to the recipient alternate delivery paths for the activity.

The default delivery mode is \"default\".

Parameters:

withDeliveryMode - The delivery mode hint.

setEntities

public void setEntities(List withEntities)

Sets payload version of the Entities in an Activity.

Parameters:

withEntities - The payload entities.

setExpiration

public void setExpiration(LocalDateTime withExpiration)

Sets the time at which the activity should be considered to be expired and should not be presented to the recipient.

Parameters:

withExpiration - The activity expiration.

setFrom

public void setFrom(ChannelAccount withFrom)

Identifies the sender of the message.

Parameters:

withFrom - The ChannelAccount of the sender.

setHistoryDisclosed

public void setHistoryDisclosed(boolean withHistoryDisclosed)

Sets whether the prior history of the channel is disclosed.

Parameters:

withHistoryDisclosed - True if the history is disclosed.

setId

public void setId(String withId)

Sets the ID that uniquely identifies the activity on the channel.

Parameters:

withId - The activity ID.

setImportance

public void setImportance(String withImportance)

Sets the importance of the activity.

Parameters:

withImportance - The activity importance.

setInputHint

public void setInputHint(InputHints withInputHint)

Indicates whether your bot is accepting, expecting, or ignoring user input after the message is delivered to the client.

Parameters:

withInputHint - The input hint for the activity.

setLabel

public void setLabel(String withLabel)

Sets the descriptive label for the activity.

Parameters:

withLabel - The activity label.

setListenFor

public void setListenFor(List withListenFor)

Sets the list of phrases and references that speech and language priming systems should listen for.

Parameters:

withListenFor - List of phrases to listen for.

setLocalTimeZone

public void setLocalTimeZone(String withLocalTimezone)

Sets the name of the local timezone of the message, expressed in IANA Time Zone database format. For example, America/Los_Angeles.

Parameters:

withLocalTimezone - The local timezone.

setLocalTimestamp

public void setLocalTimestamp(OffsetDateTime withLocalTimestamp)

Contains the local date and time of the message, expressed in ISO-8601 format. For example, 2016-09-23T13:07:49.4714686-07:00.

Parameters:

withLocalTimestamp - The local timestamp of the activity.

setLocale

public void setLocale(String withLocale)

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.

Parameters:

withLocale - The content locale.

setMembersAdded

public void setMembersAdded(List withMembersAdded)

Sets the collection of members added to the conversation.

Parameters:

withMembersAdded - List of ChannelAccount of added members.

setMembersRemoved

public void setMembersRemoved(List withMembersRemoved)

Sets the collection of members removed from the conversation.

Parameters:

withMembersRemoved - List of ChannelAccount of removed members.

setMentions

public void setMentions(List withMentions)

Sets payload version of the Mentions in an Activity.

Parameters:

withMentions - The payload entities.

setName

public void setName(String withName)

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

Parameters:

withName - The Activity name.

setProperties

public void setProperties(String key, JsonNode withValue)

Holds the overflow properties that aren't first class properties in the object. This allows extensibility while maintaining the object.

Parameters:

key - The key of the property to set.
withValue - The value for the property.

setReactionsAdded

public void setReactionsAdded(List withReactionsAdded)

Sets the collection of reactions added to the conversation.

Parameters:

withReactionsAdded - A List of MessageReaction.

setReactionsRemoved

public void setReactionsRemoved(List withReactionsRemoved)

Sets the collection of reactions removed from the conversation.

Parameters:

withReactionsRemoved - A List of MessageReaction.

setRecipient

public void setRecipient(ChannelAccount withRecipient)

Identifies the recipient of the message.

Parameters:

withRecipient - The ChannelAccount of the recipient.

setRelatesTo

public void setRelatesTo(ConversationReference withRelatesTo)

A reference to another conversation or activity.

Parameters:

withRelatesTo - The conversation reference.

setReplyToId

public void setReplyToId(String withReplyToId)

Sets the ID of the message to which this message is a reply.

Parameters:

withReplyToId - The reply to ID.

setServiceUrl

public void setServiceUrl(String withServiceUrl)

Sets the URL that specifies the channel's service endpoint. Set by the channel.

Parameters:

withServiceUrl - The service URL of the Activity.

setSpeak

public void setSpeak(String withSpeak)

Sets the text to speak.

Parameters:

withSpeak - The SSML text to speak.

setSuggestedActions

public void setSuggestedActions(SuggestedActions withSuggestedActions)

The suggested actions for the activity.

Parameters:

withSuggestedActions - The SuggestedActions for the Activity.

setSummary

public void setSummary(String withSummary)

Sets the text to display if the channel cannot render cards.

Parameters:

withSummary - The summary text.

setText

public void setText(String withText)

Sets the text content of the message.

Parameters:

withText - The text content.

setTextFormat

public void setTextFormat(TextFormatTypes withTextFormat)

Format of text fields.

Parameters:

withTextFormat - The TextFormatTypes type.

setTextHighlights

public void setTextHighlights(List withTextHighlights)

Sets the collection of text fragments to highlight when the activity contains a ReplyToId value.

Parameters:

withTextHighlights - List of TextHighlight.

setTimestamp

public void setTimestamp(OffsetDateTime withTimestamp)

Sets the date and time that the message was sent, in UTC, expressed in ISO-8601 format.

Parameters:

withTimestamp - The UTC timestamp of the activity.

setTopicName

public void setTopicName(String withTopicName)

Sets the updated topic name of the conversation.

Parameters:

withTopicName - The topic name.

setType

public void setType(String withType)

Sets the ActivityTypes of the activity.

Parameters:

withType - The type of the Activity.

setValue

public void setValue(Object withValue)

Sets the value that is associated with the activity.

Parameters:

withValue - The Activity value.

setValueType

public void setValueType(String withValueType)

Sets the type of the activity's value object.

Parameters:

withValueType - The type of Activity value.

teamsGetChannelData

public TeamsChannelData teamsGetChannelData()

Gets the TeamsChannelData.

Returns:

TeamsChannelData

teamsGetChannelId

public String teamsGetChannelId()

Get unique identifier representing a channel.

Returns:

If this is a Teams Activity with valid data, the unique identifier representing a channel.

teamsGetMeetingInfo

public TeamsMeetingInfo teamsGetMeetingInfo()

Gets the TeamsMeetingInfo object from the current activity.

Returns:

The current activity's team's meeting, or null.

teamsGetTeamId

public String teamsGetTeamId()

Get unique identifier representing a team.

Returns:

If this is a Teams Activity with valid data, the unique identifier representing a team.

teamsGetTeamInfo

public TeamInfo teamsGetTeamInfo()

Get Teams TeamInfo data.

Returns:

If this is a Teams Activity with valid data, the TeamInfo object.

teamsNotifyUser

public void teamsNotifyUser()

Sets the notification value in the TeamsChannelData to true.

teamsNotifyUser

public void teamsNotifyUser(boolean alertInMeeting, String externalResourceUrl)

Sets the notification of a meeting in the TeamsChannelData.

Parameters:

alertInMeeting - True if this is a meeting alert.
externalResourceUrl - The external resource Url.

Applies to