Conversations Interface

public interface Conversations

An instance of this class provides access to all the operations defined in Conversations.

Method Summary

Modifier and Type Method and Description
abstract java.util.concurrent.CompletableFuture<ConversationResourceResponse> createConversation(ConversationParameters parameters)

CreateConversation.

abstract java.util.concurrent.CompletableFuture<java.lang.Void> deleteActivity(String conversationId, String activityId)

DeleteActivity.

abstract java.util.concurrent.CompletableFuture<java.lang.Void> deleteConversationMember(String conversationId, String memberId)

DeleteConversationMember.

abstract java.util.concurrent.CompletableFuture<java.util.List<ChannelAccount>> getActivityMembers(String conversationId, String activityId)

GetActivityMembers.

abstract java.util.concurrent.CompletableFuture<ChannelAccount> getConversationMember(String userId, String conversationId)

Retrieves a single member of a conversation by ID.

abstract java.util.concurrent.CompletableFuture<java.util.List<ChannelAccount>> getConversationMembers(String conversationId)

GetConversationMembers.

abstract java.util.concurrent.CompletableFuture<PagedMembersResult> getConversationPagedMembers(String conversationId)

Enumerate the members of a conversation one page at a time.

abstract java.util.concurrent.CompletableFuture<PagedMembersResult> getConversationPagedMembers(String conversationId, String continuationToken)

Enumerate the members of a conversation one page at a time.

abstract java.util.concurrent.CompletableFuture<ConversationsResult> getConversations()

GetConversations.

abstract java.util.concurrent.CompletableFuture<ConversationsResult> getConversations(String continuationToken)

GetConversations.

default java.util.concurrent.CompletableFuture<ResourceResponse> replyToActivity(Activity activity)

ReplyToActivity.

abstract java.util.concurrent.CompletableFuture<ResourceResponse> replyToActivity(String conversationId, String activityId, Activity activity)

ReplyToActivity.

abstract java.util.concurrent.CompletableFuture<ResourceResponse> sendConversationHistory(String conversationId, Transcript history)

This method allows you to upload the historic activities to the conversation.

default java.util.concurrent.CompletableFuture<ResourceResponse> sendToConversation(Activity activity)

SendToConversation.

abstract java.util.concurrent.CompletableFuture<ResourceResponse> sendToConversation(String conversationId, Activity activity)

SendToConversation.

default java.util.concurrent.CompletableFuture<ResourceResponse> updateActivity(Activity activity)

UpdateActivity.

abstract java.util.concurrent.CompletableFuture<ResourceResponse> updateActivity(String conversationId, String activityId, Activity activity)

UpdateActivity.

abstract java.util.concurrent.CompletableFuture<ResourceResponse> uploadAttachment(String conversationId, AttachmentData attachmentUpload)

UploadAttachment.

Method Details

createConversation

public abstract CompletableFuture createConversation(ConversationParameters parameters)

CreateConversation. Create a new Conversation. POST to this method with a Bot being the bot creating the conversation IsGroup set to true if this is not a direct message (default is false) Members array contining the members you want to have be in the conversation. The return value is a ResourceResponse which contains a conversation id which is suitable for use in the message payload and REST API uris. Most channels only support the semantics of bots initiating a direct message conversation. An example of how to do that would be: ``` var resource = await connector.conversations.CreateConversation(new ConversationParameters(){ Bot = bot, members = new ChannelAccount[] { new ChannelAccount("user1") } ); await connect.Conversations.SendToConversation(resource.Id, new Activity() ... ) ; ```

Parameters:

parameters - Parameters to create the conversation from

Returns:

the observable to the ConversationResourceResponse object

deleteActivity

public abstract CompletableFuture deleteActivity(String conversationId, String activityId)

DeleteActivity. Delete an existing activity. Some channels allow you to delete an existing activity, and if successful this method will remove the specified activity.

Parameters:

conversationId - Conversation ID
activityId - activityId to delete

Returns:

the ServiceResponse<T> object if successful.

deleteConversationMember

public abstract CompletableFuture deleteConversationMember(String conversationId, String memberId)

DeleteConversationMember. Deletes a member from a conversation. This REST API takes a ConversationId and a memberId (of type string) and removes that member from the conversation. If that member was the last member of the conversation, the conversation will also be deleted.

Parameters:

conversationId - Conversation ID
memberId - ID of the member to delete from this conversation

Returns:

the ServiceResponse<T> object if successful.

getActivityMembers

public abstract CompletableFuture> getActivityMembers(String conversationId, String activityId)

GetActivityMembers. Enumerate the members of an activity. This REST API takes a ConversationId and a ActivityId, returning an array of ChannelAccount objects representing the members of the particular activity in the conversation.

Parameters:

conversationId - Conversation ID
activityId - Activity ID

Returns:

the observable to the List<ChannelAccount> object

getConversationMember

public abstract CompletableFuture getConversationMember(String userId, String conversationId)

Retrieves a single member of a conversation by ID.

Parameters:

userId - The user id.
conversationId - The conversation id.

Returns:

The ChannelAccount for the user.

getConversationMembers

public abstract CompletableFuture> getConversationMembers(String conversationId)

GetConversationMembers. Enumerate the members of a converstion. This REST API takes a ConversationId and returns an array of ChannelAccount objects representing the members of the conversation.

Parameters:

conversationId - Conversation ID

Returns:

the observable to the List<ChannelAccount> object

getConversationPagedMembers

public abstract CompletableFuture getConversationPagedMembers(String conversationId)

Enumerate the members of a conversation one page at a time. This REST API takes a ConversationId. Optionally a pageSize and/or continuationToken can be provided. It returns a PagedMembersResult, which contains an array of ChannelAccounts representing the members of the conversation and a continuation token that can be used to get more values. One page of ChannelAccounts records are returned with each call. The number of records in a page may vary between channels and calls. If there are no additional results the response will not contain a continuation token. If there are no members in the conversation the Members will be empty or not present in the response. A response to a request that has a continuation token from a prior request may rarely return members from a previous request.

Parameters:

conversationId - Conversation ID

Returns:

the PagedMembersResult object if successful.

getConversationPagedMembers

public abstract CompletableFuture getConversationPagedMembers(String conversationId, String continuationToken)

Enumerate the members of a conversation one page at a time. This REST API takes a ConversationId. Optionally a pageSize and/or continuationToken can be provided. It returns a PagedMembersResult, which contains an array of ChannelAccounts representing the members of the conversation and a continuation token that can be used to get more values. One page of ChannelAccounts records are returned with each call. The number of records in a page may vary between channels and calls. If there are no additional results the response will not contain a continuation token. If there are no members in the conversation the Members will be empty or not present in the response. A response to a request that has a continuation token from a prior request may rarely return members from a previous request.

Parameters:

conversationId - Conversation ID
continuationToken - The continuationToken from a previous call.

Returns:

the PagedMembersResult object if successful.

getConversations

public abstract CompletableFuture getConversations()

GetConversations. List the Conversations in which this bot has participated. GET from this method with a skip token The return value is a ConversationsResult, which contains an array of ConversationMembers and a skip token. If the skip token is not empty, then there are further values to be returned. Call this method again with the returned token to get more values. Each ConversationMembers object contains the ID of the conversation and an array of ChannelAccounts that describe the members of the conversation.

Returns:

the observable to the ConversationsResult object

getConversations

public abstract CompletableFuture getConversations(String continuationToken)

GetConversations. List the Conversations in which this bot has participated. GET from this method with a skip token The return value is a ConversationsResult, which contains an array of ConversationMembers and a skip token. If the skip token is not empty, then there are further values to be returned. Call this method again with the returned token to get more values. Each ConversationMembers object contains the ID of the conversation and an array of ChannelAccounts that describe the members of the conversation.

Parameters:

continuationToken - skip or continuation token

Returns:

the observable to the ConversationsResult object

replyToActivity

public default CompletableFuture replyToActivity(Activity activity)

ReplyToActivity. This method allows you to reply to an activity. This is slightly different from SendToConversation(). SendToConversation(conversationId) - will append the activity to the end of the conversation according to the timestamp or semantics of the channel. ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply to another activity, if the channel supports it. If the channel does not support nested replies, ReplyToActivity falls back to SendToConversation. Use ReplyToActivity when replying to a specific activity in the conversation. Use SendToConversation in all other cases.

Parameters:

activity - Activity to send

Returns:

the observable to the ResourceResponse object

replyToActivity

public abstract CompletableFuture replyToActivity(String conversationId, String activityId, Activity activity)

ReplyToActivity. This method allows you to reply to an activity. This is slightly different from SendToConversation(). SendToConversation(conversationId) - will append the activity to the end of the conversation according to the timestamp or semantics of the channel. ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply to another activity, if the channel supports it. If the channel does not support nested replies, ReplyToActivity falls back to SendToConversation. Use ReplyToActivity when replying to a specific activity in the conversation. Use SendToConversation in all other cases.

Parameters:

conversationId - Conversation ID
activityId - activityId the reply is to (OPTIONAL)
activity - Activity to send

Returns:

the observable to the ResourceResponse object

sendConversationHistory

public abstract CompletableFuture sendConversationHistory(String conversationId, Transcript history)

This method allows you to upload the historic activities to the conversation. Sender must ensure that the historic activities have unique ids and appropriate timestamps. The ids are used by the client to deal with duplicate activities and the timestamps are used by the client to render the activities in the right order.

Parameters:

conversationId - Conversation ID
history - Historic activities

Returns:

the ResourceResponse object if successful.

sendToConversation

public default CompletableFuture sendToConversation(Activity activity)

SendToConversation. This method allows you to send an activity to the end of a conversation. This is slightly different from ReplyToActivity(). sendToConverstion(activity) - will append the activity to the end of the conversation according to the timestamp or semantics of the channel, using the Activity.getConversation.getId for the conversation id. replyToActivity(conversationId,ActivityId) - adds the activity as a reply to another activity, if the channel supports it. If the channel does not support nested replies, ReplyToActivity falls back to SendToConversation. Use ReplyToActivity when replying to a specific activity in the conversation. Use SendToConversation in all other cases.

Parameters:

activity - Activity to send

Returns:

the observable to the ResourceResponse object

sendToConversation

public abstract CompletableFuture sendToConversation(String conversationId, Activity activity)

SendToConversation. This method allows you to send an activity to the end of a conversation. This is slightly different from ReplyToActivity(). SendToConverstion(conversationId) - will append the activity to the end of the conversation according to the timestamp or semantics of the channel. ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply to another activity, if the channel supports it. If the channel does not support nested replies, ReplyToActivity falls back to SendToConversation. Use ReplyToActivity when replying to a specific activity in the conversation. Use SendToConversation in all other cases.

Parameters:

conversationId - Conversation ID
activity - Activity to send

Returns:

the observable to the ResourceResponse object

updateActivity

public default CompletableFuture updateActivity(Activity activity)

UpdateActivity. Edit an existing activity. Some channels allow you to edit an existing activity to reflect the new state of a bot conversation. For example, you can remove buttons after someone has clicked "Approve" button.

Parameters:

activity - replacement Activity

Returns:

the observable to the ResourceResponse object

updateActivity

public abstract CompletableFuture updateActivity(String conversationId, String activityId, Activity activity)

UpdateActivity. Edit an existing activity. Some channels allow you to edit an existing activity to reflect the new state of a bot conversation. For example, you can remove buttons after someone has clicked "Approve" button.

Parameters:

conversationId - Conversation ID
activityId - activityId to update
activity - replacement Activity

Returns:

the observable to the ResourceResponse object

uploadAttachment

public abstract CompletableFuture uploadAttachment(String conversationId, AttachmentData attachmentUpload)

UploadAttachment. Upload an attachment directly into a channel's blob storage. This is useful because it allows you to store data in a compliant store when dealing with enterprises. The response is a ResourceResponse which contains an AttachmentId which is suitable for using with the attachments API.

Parameters:

conversationId - Conversation ID
attachmentUpload - Attachment data

Returns:

the observable to the ResourceResponse object

Applies to