UNPKG

botbuilder-core

Version:

Core components for Microsoft Bot Builder. Components in this library can run either in a browser or on the server.

126 lines 6.15 kB
import { BotTelemetryClient } from './botTelemetryClient'; import { Middleware } from './middlewareSet'; import { TurnContext } from './turnContext'; import { Activity } from 'botframework-schema'; /** * Middleware for logging incoming, outgoing, updated or deleted Activity messages. * Uses the botTelemetryClient interface. */ export declare class TelemetryLoggerMiddleware implements Middleware { /** * The name of the event when when new message is received from the user. */ static readonly botMsgReceiveEvent: string; /** * The name of the event when a message is updated by the bot. */ static readonly botMsgSendEvent: string; /** * The name of the event when a message is updated by the bot. */ static readonly botMsgUpdateEvent: string; /** * The name of the event when a message is deleted by the bot. */ static readonly botMsgDeleteEvent: string; private readonly _telemetryClient; private readonly _logPersonalInformation; /** * Initializes a new instance of the TelemetryLoggerMiddleware class. * * @param telemetryClient The BotTelemetryClient used for logging. * @param logPersonalInformation (Optional) Enable/Disable logging original message name within Application Insights. */ constructor(telemetryClient: BotTelemetryClient, logPersonalInformation?: boolean); /** * Gets a value indicating whether to log personal information that came from the user. * * @returns A value indicating whether to log personal information or not. */ get logPersonalInformation(): boolean; /** * Gets the currently configured botTelemetryClient that logs the events. * * @returns The currently configured [BotTelemetryClient](xref:botbuilder-core.BotTelemetryClient) that logs the events. */ get telemetryClient(): BotTelemetryClient; /** * Logs events based on incoming and outgoing activities using the botTelemetryClient class. * * @param context The context object for this turn. * @param next The delegate to call to continue the bot middleware pipeline */ onTurn(context: TurnContext, next: () => Promise<void>): Promise<void>; /** * Invoked when a message is received from the user. * Performs logging of telemetry data using the IBotTelemetryClient.TrackEvent() method. * The event name logged is "BotMessageReceived". * * @param activity Current activity sent from user. */ protected onReceiveActivity(activity: Activity): Promise<void>; /** * Invoked when the bot sends a message to the user. * Performs logging of telemetry data using the botTelemetryClient.trackEvent() method. * The event name logged is "BotMessageSend". * * @param activity Last activity sent from user. */ protected onSendActivity(activity: Activity): Promise<void>; /** * Invoked when the bot updates a message. * Performs logging of telemetry data using the botTelemetryClient.trackEvent() method. * The event name used is "BotMessageUpdate". * * @param activity Current activity sent from user. */ protected onUpdateActivity(activity: Activity): Promise<void>; /** * Invoked when the bot deletes a message. * Performs logging of telemetry data using the botTelemetryClient.trackEvent() method. * The event name used is "BotMessageDelete". * * @param activity Current activity sent from user. */ protected onDeleteActivity(activity: Activity): Promise<void>; /** * Fills the Application Insights Custom Event properties for BotMessageReceived. * These properties are logged in the custom event when a new message is received from the user. * * @param activity Last activity sent from user. * @param telemetryProperties Additional properties to add to the event. * @returns A dictionary that is sent as "Properties" to botTelemetryClient.trackEvent method. */ protected fillReceiveEventProperties(activity: Activity, telemetryProperties?: Record<string, string>): Promise<Record<string, string>>; /** * Fills the Application Insights Custom Event properties for BotMessageSend. * These properties are logged in the custom event when a response message is sent by the Bot to the user. * * @param activity - Last activity sent from user. * @param telemetryProperties Additional properties to add to the event. * @returns A dictionary that is sent as "Properties" to botTelemetryClient.trackEvent method. */ protected fillSendEventProperties(activity: Activity, telemetryProperties?: Record<string, string>): Promise<Record<string, string>>; /** * Fills the event properties for BotMessageUpdate. * These properties are logged when an activity message is updated by the Bot. * For example, if a card is interacted with by the use, and the card needs to be updated to reflect * some interaction. * * @param activity - Last activity sent from user. * @param telemetryProperties Additional properties to add to the event. * @returns A dictionary that is sent as "Properties" to botTelemetryClient.trackEvent method. */ protected fillUpdateEventProperties(activity: Activity, telemetryProperties?: Record<string, string>): Promise<Record<string, string>>; /** * Fills the Application Insights Custom Event properties for BotMessageDelete. * These properties are logged in the custom event when an activity message is deleted by the Bot. This is a relatively rare case. * * @param activity - Last activity sent from user. * @param telemetryProperties Additional properties to add to the event. * @returns A dictionary that is sent as "Properties" to botTelemetryClient.trackEvent method. */ protected fillDeleteEventProperties(activity: Activity, telemetryProperties?: Record<string, string>): Promise<Record<string, string>>; private populateAdditionalChannelProperties; } //# sourceMappingURL=telemetryLoggerMiddleware.d.ts.map