How to use the botframework-schema.ActivityTypes.Invoke function in botframework-schema

To help you get started, we’ve selected a few botframework-schema examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / botframework-solutions / lib / typescript / botbuilder-skills / src / websocket / skillWebSocketBotAdapter.ts View on Github external
public async processActivity(activity: Activity, callback: BotCallbackHandler): Promise {
        const message: string = `Received an incoming activity. ActivityId: ${activity.id}`;
        this.telemetryClient.trackTrace({
            message: message,
            severityLevel: Severity.Information
        });

        const context: TurnContext = new TurnContext(this, activity);
        await this.runMiddleware(context, callback);

        // We do not support Invoke in websocket transport
        if (activity.type === ActivityTypes.Invoke) {
            return { status: 501 };
        }

        return { status: 200 };
    }
github microsoft / botbuilder-js / libraries / botbuilder-streaming-extensions / src / BotFrameworkStreamingAdapter.ts View on Github external
if (request.path.toLocaleLowerCase() !== MESSAGES_PATH) {
            response.statusCode = StatusCodes.NOT_FOUND;

            return response;
        }

        try {           
            this.middleWare.forEach((mw): void => {
                this.use(mw);
            });
            let context = new TurnContext(this, body);
            await this.runMiddleware(context, async (turnContext): Promise => {
                await this.bot.run(turnContext);
            });

            if (body.type === ActivityTypes.Invoke) {
                let invokeResponse: any = context.turnState.get(INVOKE_RESPONSE);

                if (invokeResponse && invokeResponse.value) {
                    const value: InvokeResponse = invokeResponse.value;
                    response.statusCode = value.status;
                    response.setBody(value.body);
                } else {
                    response.statusCode = StatusCodes.NOT_IMPLEMENTED;
                }
            } else {
                response.statusCode = StatusCodes.OK;
            }
        } catch (error) {
            response.statusCode = StatusCodes.INTERNAL_SERVER_ERROR;
            this.logger.log(error);