Documentation - v1.5.0-beta.6
    Preparing search index...

    Adapter for handling agent interactions with various channels through cloud-based services.

    CloudAdapter processes incoming HTTP requests from Azure Bot Service channels, authenticates them, and generates outgoing responses. It manages the communication flow between agents and users across different channels, handling activities, attachments, and conversation continuations.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    connectionManager: Connections

    Client for connecting to the Azure Bot Service

    ConnectorClientKey: symbol = ...

    Symbol key used to store connector client instances in the TurnContext.

    middleware: MiddlewareSet = ...

    The middleware set used to process the pipeline of middleware handlers.

    UserTokenClientKey: symbol = ...

    Symbol key used to store User Token Client instances in the TurnContext.

    Accessors

    Methods

    • Continues a conversation.

      Parameters

      • botAppIdOrIdentity: string | JwtPayload

        The bot identity to use when continuing the conversation. This can be either: a string containing the bot's App ID (botId) or a JwtPayload object containing identity claims (must include aud).

      • reference: ConversationReference

        The conversation reference to continue.

      • logic: (revocableContext: TurnContext) => Promise<void>

        The logic to execute.

      • isResponse: Boolean = false

        No longer used.

      Returns Promise<void>

      A promise representing the completion of the continue operation.

    • Protected

      Creates a connector client for a specific service URL and scope.

      Parameters

      • serviceUrl: string

        The URL of the service to connect to.

      • scope: string

        The authentication scope to use.

      • identity: JwtPayload

        The identity used to select the token provider.

      • Optionalheaders: HeaderPropagationCollection

        Optional headers to propagate in the request.

      Returns Promise<ConnectorClient>

      A promise that resolves to a ConnectorClient instance.

    • Creates a conversation.

      Parameters

      • agentAppId: string

        The agent application ID.

      • channelId: string

        The channel ID.

      • serviceUrl: string

        The service URL.

      • audience: string

        The audience.

      • conversationParameters: ConversationParameters

        The conversation parameters.

      • logic: (context: TurnContext) => Promise<void>

        The logic to execute.

      Returns Promise<void>

      A promise representing the completion of the create operation.

    • Creates an activity to represent the result of creating a conversation.

      Parameters

      • createdConversationId: string | undefined

        The ID of the created conversation.

      • channelId: string

        The channel ID.

      • serviceUrl: string

        The service URL.

      • conversationParameters: ConversationParameters

        The conversation parameters.

      Returns Activity

      The created activity.

    • Protected

      Creates a user token client for a specific service URL and scope.

      Parameters

      • identity: JwtPayload

        The identity used to select the token provider.

      • tokenServiceEndpoint: string = ...

        The endpoint to connect to.

      • scope: string = 'https://api.botframework.com'

        The authentication scope to use.

      • audience: string = 'https://api.botframework.com'

        No longer used.

      • Optionalheaders: HeaderPropagationCollection

        Optional headers to propagate in the request

      Returns Promise<UserTokenClient>

      A promise that resolves to a UserTokenClient instance.

    • Parameters

      • context: TurnContext

        The context for the turn.

      • attachmentId: string

        The attachment ID.

      • viewId: string

        The view ID.

      Returns Promise<ReadableStream>

      A promise representing the NodeJS.ReadableStream for the requested attachment.

      This function will not be supported in future versions. Use TurnContext.turnState.get(CloudAdapter.ConnectorClientKey). Gets an attachment.

    • Processes an incoming request and sends the response.

      Parameters

      • request: Request

        The incoming request.

      • res: Response

        The response to send.

      • logic: (context: TurnContext) => Promise<void>

        The logic to execute.

      • OptionalheaderPropagation: HeaderPropagationDefinition

        Optional function to handle header propagation.

      Returns Promise<void>

      This function supports both authenticated and unauthenticated requests. When the request is not authenticated, the adapter will use anonymous identity. For authenticated requests, the adapter relies on the presence of a user identity on request.user. It is strongly recommended to use the authorizeJWT middleware to ensure that requests are correctly authenticated.

    • Protected

      Determines whether a connector client is needed based on the delivery mode and service URL of the given activity.

      Parameters

      • activity: Activity

        The activity to evaluate.

      Returns boolean

      true if a ConnectorClient is needed, false otherwise. A connector client is required if the activity's delivery mode is not "ExpectReplies" and the service URL is not null or empty.

    • Creates the JwtPayload object with the provided appId.

      Parameters

      • appId: string

        The bot's appId.

      Returns JwtPayload

      The JwtPayload object containing the appId as aud.