I have an bot which is setup using the BotFrameworkAdapter. I can see my message extension requests hit my server and can process these in my ActivityHandler.onTurn method. However, I cannot see how I can reply to these requests using the TurnContext.

In the examples, I have seen teamChatConnector.onQuery from the page https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/messaging-extensions/search-extensions#nodejs but this is not using the BotFrameworkAdapter.

Can anyone point me in the direction of how I can do this using the latest BotFrameworkAdapter which I've been basing on the samples in https://github.com/Microsoft/BotBuilder-Samples samples-work-in-progress branch. There also seems to be no examples surrounding this.

1 Answers

1
Brendan Hart On Best Solutions

It seems like messaging extensions are Teams specific functionality, and as a result the botbuilder-teams package should be used to make use of the Teams specific feature - specifically version 4.0.0-beta1.

From the documentation in the README of botbuilder-teams, it states to add adapter.use(new teams.TeamsMiddleware()); to extend the bot to support Microsoft Teams.

You can then make use of the teams.TeamsActivityProcessor. Setting this processor up in a way that provides the invokeActivityHandler with a onMessagingExtensionQuery method, as in the sample shared by Wajeed, means that if you delegate your handling of messages to the processor, the messaging extension request will be handled.