BotFrameworkHttpClient Class
- java.
lang. Object - com.
microsoft. bot. builder. skills. BotFrameworkClient - com.
microsoft. bot. integration. BotFrameworkHttpClient
- com.
- com.
public class BotFrameworkHttpClient
extends BotFrameworkClient
Class for posting activities securely to a bot using BotFramework HTTP protocol. This class can be used to securely post activities to a bot using the Bot Framework HTTP protocol. There are 2 usage patterns:* Forwarding activity to a Skill (Bot -> Bot as a Skill) which is done via PostActivity(fromBotId, toBotId, endpoint, serviceUrl, activity);* Posting an activity to yourself (External service -> Bot) which is done via PostActivity(botId, endpoint, activity)The latter is used by external services such as webjobs that need to post activities to the bot using the bots own credentials.
Constructor Summary
| Constructor | Description |
|---|---|
| BotFrameworkHttpClient(CredentialProvider credentialProvider, ChannelProvider channelProvider) |
Initializes a new instance of the BotFrameworkHttpClient class. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
java.util.concurrent.CompletableFuture<Typed |
<T>postActivity(String fromBotId, String toBotId, URI toUrl, URI serviceUrl, String conversationId, Activity activity, Class<T> type)
Forwards an activity to a skill (bot). |
|
java.util.concurrent.CompletableFuture<Typed |
<T>postActivity(String botId, URI botEndpoint, Activity activity, Class<T> type)
Post Activity to the bot using the bot's credentials. |
|
protected
java.util.concurrent.CompletableFuture<App |
buildCredentials(String appId, String oAuthScope)
Logic to build an AppCredentials Object to be used to acquire tokens for this get |
|
protected static
java.util.Map<java.lang.String,App |
getAppCredentialMapCache()
Gets the Cache for app |
|
protected
Channel |
getChannelProvider()
Gets the channel provider for this adapter. |
|
protected
Credential |
getCredentialProvider()
Gets the credential provider for this adapter. |
| okhttp3.OkHttpClient |
getHttpClient()
Gets the Http |
Methods inherited from BotFrameworkClient
Methods inherited from java.lang.Object
Constructor Details
BotFrameworkHttpClient
public BotFrameworkHttpClient(CredentialProvider credentialProvider, ChannelProvider channelProvider)
Initializes a new instance of the BotFrameworkHttpClient class.
Parameters:
Method Details
<T>postActivity
public CompletableFuture
Forwards an activity to a skill (bot). NOTE: Forwarding an activity to a skill will flush UserState and ConversationState changes so that skill has accurate state.
Overrides:
BotFrameworkHttpClient.<T>postActivity(String fromBotId, String toBotId, URI toUrl, URI serviceUrl, String conversationId, Activity activity, Class<T> type)Parameters:
Returns:
<T>postActivity
public CompletableFuture
Post Activity to the bot using the bot's credentials.
Parameters:
Returns:
buildCredentials
protected CompletableFuture
Logic to build an AppCredentials Object to be used to acquire tokens for this getHttpClient().
Parameters:
Returns:
getAppCredentialMapCache
protected static Map
Gets the Cache for appCredentials to speed up token acquisition (a token is not requested unless is expired). AppCredentials are cached using appId + scope (this last parameter is only used if the app credentials are used to call a skill).
Returns:
getChannelProvider
protected ChannelProvider getChannelProvider()
Gets the channel provider for this adapter.
Returns:
getCredentialProvider
protected CredentialProvider getCredentialProvider()
Gets the credential provider for this adapter.
Returns:
getHttpClient
public OkHttpClient getHttpClient()
Gets the HttpClient for this adapter.
Returns: