CloudAdapter class

An adapter that implements the Bot Framework Protocol and can be hosted in different cloud environmens both public and private.

Extends

CloudAdapterBase

Constructors

CloudAdapter(BotFrameworkAuthentication)

Initializes a new instance of the CloudAdapter class.

Inherited Properties

BotIdentityKey
ConnectorClientKey
ConnectorFactoryKey
OAuthScopeKey
onTurnError
UserTokenClientKey

Methods

connectNamedPipe(string, (context: TurnContext) => Promise<void>, string, string, string, number)

Used to connect the adapter to a named pipe.

process(Request, INodeSocket, INodeBuffer, (context: TurnContext) => Promise<void>)

Handle a web socket connection by applying a logic function to each streaming request.

process(Request, Response, (context: TurnContext) => Promise<void>)

Process a web request by applying a logic function.

Inherited Methods

continueConversation(Partial<ConversationReference>, (context: TurnContext) => Promise<void>)
continueConversationAsync(string | ClaimsIdentity, Partial<ConversationReference>, (context: TurnContext) => Promise<void> | string, (context: TurnContext) => Promise<void>)
createConversationAsync(string, string, string, string, ConversationParameters, (context: TurnContext) => Promise<void>)
deleteActivity(TurnContext, Partial<ConversationReference>)
sendActivities(TurnContext, Partial<Activity>[])
updateActivity(TurnContext, Partial<Activity>)
use((context: TurnContext, next: () => Promise<void>) => Promise<void> | Middleware[])

Adds middleware to the adapter's pipeline.

Constructor Details

CloudAdapter(BotFrameworkAuthentication)

Initializes a new instance of the CloudAdapter class.

new CloudAdapter(botFrameworkAuthentication?: BotFrameworkAuthentication)

Parameters

botFrameworkAuthentication

BotFrameworkAuthentication

Optional BotFrameworkAuthentication instance

Inherited Property Details

BotIdentityKey

BotIdentityKey: symbol

Property Value

symbol

Inherited From BotAdapter.BotIdentityKey

ConnectorClientKey

ConnectorClientKey: symbol

Property Value

symbol

Inherited From BotAdapter.ConnectorClientKey

ConnectorFactoryKey

ConnectorFactoryKey: symbol

Property Value

symbol

Inherited From CloudAdapterBase.ConnectorFactoryKey

OAuthScopeKey

OAuthScopeKey: symbol

Property Value

symbol

Inherited From BotAdapter.OAuthScopeKey

onTurnError

onTurnError: (context: TurnContext, error: Error) => Promise<void>

Property Value

(context: TurnContext, error: Error) => Promise<void>

Inherited From BotAdapter.onTurnError

UserTokenClientKey

UserTokenClientKey: symbol

Property Value

symbol

Inherited From CloudAdapterBase.UserTokenClientKey

Method Details

connectNamedPipe(string, (context: TurnContext) => Promise<void>, string, string, string, number)

Used to connect the adapter to a named pipe.

function connectNamedPipe(pipeName: string, logic: (context: TurnContext) => Promise<void>, appId: string, audience: string, callerId?: string, retryCount?: number): Promise<void>

Parameters

pipeName

string

Pipe name to connect to (note: yields two named pipe servers by appending ".incoming" and ".outgoing" to this name)

logic

(context: TurnContext) => Promise<void>

The logic function to call for resulting bot turns.

appId

string

The Bot application ID

audience

string

The audience to use for outbound communication. The will vary by cloud environment.

callerId

string

Optional, the caller ID

retryCount

number

Optional, the number of times to retry a failed connection (defaults to 7)

Returns

Promise<void>

process(Request, INodeSocket, INodeBuffer, (context: TurnContext) => Promise<void>)

Handle a web socket connection by applying a logic function to each streaming request.

function process(req: Request, socket: INodeSocket, head: INodeBuffer, logic: (context: TurnContext) => Promise<void>): Promise<void>

Parameters

req
Request

An incoming HTTP Request

socket

INodeSocket

The corresponding INodeSocket

head

INodeBuffer

The corresponding INodeBuffer

logic

(context: TurnContext) => Promise<void>

The logic function to apply

Returns

Promise<void>

a promise representing the asynchronous operation.

process(Request, Response, (context: TurnContext) => Promise<void>)

Process a web request by applying a logic function.

function process(req: Request, res: Response, logic: (context: TurnContext) => Promise<void>): Promise<void>

Parameters

req
Request

The corresponding HTTP Response

res
Response
logic

(context: TurnContext) => Promise<void>

The logic function to apply

Returns

Promise<void>

a promise representing the asynchronous operation.

Inherited Method Details

continueConversation(Partial<ConversationReference>, (context: TurnContext) => Promise<void>)

Warning

This API is now deprecated.

function continueConversation(_reference: Partial<ConversationReference>, _logic: (context: TurnContext) => Promise<void>): Promise<void>

Parameters

_reference

Partial<ConversationReference>

_logic

(context: TurnContext) => Promise<void>

Returns

Promise<void>

Inherited From CloudAdapterBase.continueConversation

continueConversationAsync(string | ClaimsIdentity, Partial<ConversationReference>, (context: TurnContext) => Promise<void> | string, (context: TurnContext) => Promise<void>)

function continueConversationAsync(botAppIdOrClaimsIdentity: string | ClaimsIdentity, reference: Partial<ConversationReference>, logicOrAudience: (context: TurnContext) => Promise<void> | string, maybeLogic?: (context: TurnContext) => Promise<void>): Promise<void>

Parameters

botAppIdOrClaimsIdentity

string | ClaimsIdentity

reference

Partial<ConversationReference>

logicOrAudience

(context: TurnContext) => Promise<void> | string

maybeLogic

(context: TurnContext) => Promise<void>

Returns

Promise<void>

Inherited From CloudAdapterBase.continueConversationAsync

createConversationAsync(string, string, string, string, ConversationParameters, (context: TurnContext) => Promise<void>)

function createConversationAsync(botAppId: string, channelId: string, serviceUrl: string, audience: string, conversationParameters: ConversationParameters, logic: (context: TurnContext) => Promise<void>): Promise<void>

Parameters

botAppId

string

channelId

string

serviceUrl

string

audience

string

conversationParameters

ConversationParameters

logic

(context: TurnContext) => Promise<void>

Returns

Promise<void>

Inherited From CloudAdapterBase.createConversationAsync

deleteActivity(TurnContext, Partial<ConversationReference>)

function deleteActivity(context: TurnContext, reference: Partial<ConversationReference>): Promise<void>

Parameters

context

TurnContext

reference

Partial<ConversationReference>

Returns

Promise<void>

Inherited From CloudAdapterBase.deleteActivity

sendActivities(TurnContext, Partial<Activity>[])

function sendActivities(context: TurnContext, activities: Partial<Activity>[]): Promise<ResourceResponse[]>

Parameters

context

TurnContext

activities

Partial<Activity>[]

Returns

Promise<ResourceResponse[]>

Inherited From CloudAdapterBase.sendActivities

updateActivity(TurnContext, Partial<Activity>)

function updateActivity(context: TurnContext, activity: Partial<Activity>): Promise<ResourceResponse | void>

Parameters

context

TurnContext

activity

Partial<Activity>

Returns

Promise<ResourceResponse | void>

Inherited From CloudAdapterBase.updateActivity

use((context: TurnContext, next: () => Promise<void>) => Promise<void> | Middleware[])

Adds middleware to the adapter's pipeline.

function use(middlewares: (context: TurnContext, next: () => Promise<void>) => Promise<void> | Middleware[]): this

Parameters

middlewares

(context: TurnContext, next: () => Promise<void>) => Promise<void> | Middleware[]

The middleware or middleware handlers to add.

Returns

this

The updated adapter object.

Remarks

Middleware is added to the adapter at initialization time. Each turn, the adapter calls its middleware in the order in which you added it.

Inherited From BotAdapter.use