Added Teams botbuilder changes and sample #57 by tracyboehrer · Pull Request #409 · microsoft/botbuilder-java · GitHub
Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import com.microsoft.bot.rest.retry.RetryStrategy;
import org.apache.commons.lang3.StringUtils;

import java.net.HttpURLConnection;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
Expand Down Expand Up @@ -74,19 +75,19 @@
*/
public class BotFrameworkAdapter extends BotAdapter implements AdapterIntegration, UserTokenProvider {
/**
* Key to store Activity to match .Net.
* Key to store InvokeResponse.
*/
private static final String INVOKE_RESPONSE_KEY = "BotFrameworkAdapter.InvokeResponse";
public static final String INVOKE_RESPONSE_KEY = "BotFrameworkAdapter.InvokeResponse";

/**
* Key to store bot claims identity to match .Net.
* Key to store bot claims identity.
*/
private static final String BOT_IDENTITY_KEY = "BotIdentity";

/**
* Key to store ConnectorClient to match .Net.
* Key to store ConnectorClient.
*/
private static final String CONNECTOR_CLIENT_KEY = "ConnectorClient";
public static final String CONNECTOR_CLIENT_KEY = "ConnectorClient";

private AppCredentials appCredentials;

Expand Down Expand Up @@ -365,7 +366,9 @@ public CompletableFuture<InvokeResponse> processActivity(ClaimsIdentity identity
if (activity.isType(ActivityTypes.INVOKE)) {
Activity invokeResponse = context.getTurnState().get(INVOKE_RESPONSE_KEY);
if (invokeResponse == null) {
throw new IllegalStateException("Bot failed to return a valid 'invokeResponse' activity.");
return CompletableFuture.completedFuture(
new InvokeResponse(HttpURLConnection.HTTP_NOT_IMPLEMENTED, null)
);
} else {
return CompletableFuture.completedFuture((InvokeResponse) invokeResponse.getValue());
}
Expand Down
Loading