SkillHandler Class

public class SkillHandler
extends ChannelServiceHandler

A Bot Framework Handler for skills.

Field Summary

Modifier and Type Field and Description
static final java.lang.String SKILL_CONVERSATION_REFERENCE_KEY

The skill conversation reference.

Constructor Summary

Constructor Description
SkillHandler(BotAdapter adapter, Bot bot, SkillConversationIdFactoryBase conversationIdFactory, CredentialProvider credentialProvider, AuthenticationConfiguration authConfig, ChannelProvider channelProvider)

Initializes a new instance of the SkillHandler class, using a credential provider.

Method Summary

Modifier and Type Method and Description
protected java.util.concurrent.CompletableFuture<java.lang.Void> onDeleteActivity(ClaimsIdentity claimsIdentity, String conversationId, String activityId)

OnDeleteActivity() API.

protected java.util.concurrent.CompletableFuture<ResourceResponse> onReplyToActivity(ClaimsIdentity claimsIdentity, String conversationId, String activityId, Activity activity)

ReplyToActivity() API for Skill.

protected java.util.concurrent.CompletableFuture<ResourceResponse> onSendToConversation(ClaimsIdentity claimsIdentity, String conversationId, Activity activity)

SendToConversation() API for Skill.

protected java.util.concurrent.CompletableFuture<ResourceResponse> onUpdateActivity(ClaimsIdentity claimsIdentity, String conversationId, String activityId, Activity activity)

OnUpdateActivity() API.

Methods inherited from ChannelServiceHandler

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

Field Details

SKILL_CONVERSATION_REFERENCE_KEY

public static final String SKILL_CONVERSATION_REFERENCE_KEY

The skill conversation reference.

Constructor Details

SkillHandler

public SkillHandler(BotAdapter adapter, Bot bot, SkillConversationIdFactoryBase conversationIdFactory, CredentialProvider credentialProvider, AuthenticationConfiguration authConfig, ChannelProvider channelProvider)

Initializes a new instance of the SkillHandler class, using a credential provider.

Parameters:

adapter - An instance of the BotAdapter that will handle the request.
bot - The IBot instance.
conversationIdFactory - A SkillConversationIdFactoryBase to unpack the conversation ID and map it to the calling bot.
credentialProvider - The credential provider.
authConfig - The authentication configuration.
channelProvider - The channel provider. Use a MiddlewareSet Object to add multiple middleware components in the constructor. Use the Use(Middleware ) method to add additional middleware to the adapter after construction.

Method Details

onDeleteActivity

protected CompletableFuture onDeleteActivity(ClaimsIdentity claimsIdentity, String conversationId, String activityId)

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.

Overrides:

SkillHandler.onDeleteActivity(ClaimsIdentity claimsIdentity, String conversationId, String activityId)

Parameters:

claimsIdentity
conversationId
activityId

onReplyToActivity

protected CompletableFuture onReplyToActivity(ClaimsIdentity claimsIdentity, String conversationId, String activityId, Activity activity)

ReplyToActivity() API for Skill. 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.

Overrides:

SkillHandler.onReplyToActivity(ClaimsIdentity claimsIdentity, String conversationId, String activityId, Activity activity)

Parameters:

claimsIdentity - claimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
conversationId - Conversation ID.
activityId - activityId the reply is to (OPTIONAL).
activity - Activity to send.

Returns:

task for a resource response.

onSendToConversation

protected CompletableFuture onSendToConversation(ClaimsIdentity claimsIdentity, String conversationId, Activity activity)

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.

Overrides:

SkillHandler.onSendToConversation(ClaimsIdentity claimsIdentity, String conversationId, Activity activity)

Parameters:

claimsIdentity - claimsIdentity for the bot, should have AudienceClaim, AppIdClaim and ServiceUrlClaim.
conversationId - conversationId.
activity - Activity to send.

Returns:

task for a resource response.

onUpdateActivity

protected CompletableFuture onUpdateActivity(ClaimsIdentity claimsIdentity, String conversationId, String activityId, Activity activity)

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.

Overrides:

SkillHandler.onUpdateActivity(ClaimsIdentity claimsIdentity, String conversationId, String activityId, Activity activity)

Parameters:

claimsIdentity
conversationId
activityId
activity

Applies to