ChannelServiceHandler Class
- java.
lang. Object - com.
microsoft. bot. builder. ChannelServiceHandler
- com.
public class ChannelServiceHandler
A class to help with the implementation of the Bot Framework protocol.
Constructor Summary
| Constructor | Description |
|---|---|
| ChannelServiceHandler(CredentialProvider credentialProvider, AuthenticationConfiguration authConfiguration, ChannelProvider channelProvider) |
Initializes a new instance of the ChannelServiceHandler class, using a credential provider. |
Method Summary
Methods inherited from java.lang.Object
Constructor Details
ChannelServiceHandler
public ChannelServiceHandler(CredentialProvider credentialProvider, AuthenticationConfiguration authConfiguration, ChannelProvider channelProvider)
Initializes a new instance of the ChannelServiceHandler class, using a credential provider.
Parameters:
Method Details
getChannelProvider
protected ChannelProvider getChannelProvider()
Gets the channel provider that implements ChannelProvider .
Returns:
handleCreateConversation
public CompletableFuture
Create a new Conversation.
Parameters:
Returns:
handleDeleteActivity
public CompletableFuture
Deletes an existing activity.
Parameters:
Returns:
handleDeleteConversationMember
public CompletableFuture
Deletes a member from a conversation.
Parameters:
Returns:
handleGetActivityMembers
public CompletableFuture> handleGetActivityMembers(String authHeader, String conversationId, String activityId)
Enumerates the members of an activity.
Parameters:
Returns:
handleGetConversationMembers
public CompletableFuture> handleGetConversationMembers(String authHeader, String conversationId)
Enumerates the members of a conversation.
Parameters:
Returns:
handleGetConversationPagedMembers
public CompletableFuture
Enumerates the members of a conversation one page at a time.
Parameters:
Returns:
handleGetConversations
public CompletableFuture
Lists the Conversations in which the bot has participated.
Parameters:
Returns:
handleReplyToActivity
public CompletableFuture
Sends a reply to an activity.
Parameters:
Returns:
handleSendConversationHistory
public CompletableFuture
Uploads the historic activities of the conversation.
Parameters:
Returns:
handleSendToConversation
public CompletableFuture
Sends an activity to the end of a conversation.
Parameters:
Returns:
handleUpdateActivity
public CompletableFuture
Edits a previously sent existing activity.
Parameters:
Returns:
handleUploadAttachment
public CompletableFuture
Stores data in a compliant store when dealing with enterprises.
Parameters:
Returns:
onCreateConversation
protected CompletableFuture
CreateConversation() API. Override this method to 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 instanceof false) * Array containing the members to include in the conversation The return value is a ResourceResponse which contains a conversation D 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 = connector.getconversations().CreateConversation(new ConversationParameters(){ Bot = bot, members = new ChannelAccount[] { new ChannelAccount("user1") } ); connect.getConversations().OnSendToConversation(resource.getId(), new Activity() ... ) ; end.
Parameters:
Returns:
onDeleteActivity
protected CompletableFuture
OnDeleteActivity() API. Override this method to Delete an existing activity. Some channels allow you to delete an existing activity, and if successful this method will remove the specified activity.
Parameters:
Returns:
onDeleteConversationMember
protected CompletableFuture
DeleteConversationMember() API for Skill. Override this method to 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:
Returns:
onGetActivityMembers
protected CompletableFuture> onGetActivityMembers(ClaimsIdentity claimsIdentity, String conversationId, String activityId)
OnGetActivityMembers() API. Override this method to 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:
Returns:
onGetConversationMembers
protected CompletableFuture> onGetConversationMembers(ClaimsIdentity claimsIdentity, String conversationId)
GetConversationMembers() API for Skill. Override this method to enumerate the members of a conversation. This REST API takes a ConversationId and returns an array of ChannelAccount Objects representing the members of the conversation.
Parameters:
Returns:
onGetConversationPagedMembers
protected CompletableFuture
GetConversationPagedMembers() API for Skill. Override this method to 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. The pageSize parameter can be used as a suggestion. 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:
Returns:
onGetConversations
protected CompletableFuture
OnGetConversations() API for Skill. Override this method to 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 D of the conversation and an array of ChannelAccounts that describe the members of the conversation.
Parameters:
Returns:
onReplyToActivity
protected CompletableFuture
OnReplyToActivity() API. Override this method allows 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:
Returns:
onSendConversationHistory
protected CompletableFuture
SendConversationHistory() API for Skill. Override this method to 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:
Returns:
onSendToConversation
protected CompletableFuture
SendToConversation() API for Skill. This method allows you to send an activity to the end of a conversation. This is slightly different from ReplyToActivity(). * 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:
Returns:
onUpdateActivity
protected CompletableFuture
OnUpdateActivity() API. Override this method to edit a previously sent 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:
Returns:
onUploadAttachment
protected CompletableFuture
UploadAttachment() API. Override this method 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:
Returns: