I want to send an adaptive card to specific channel using bot. I used webhook and it was easy to achieve this, but I have to use bot for curtain scenario in stead of webhook.
When handleTeamsMessagingExtensionSubmitAction is invoked by submit action, it returns an error: Unable to extract ConnectorClient from turn context.
my current code is:
public async handleTeamsMessagingExtensionSubmitAction(
context: TurnContext,
action: MessagingExtensionAction
): Promise<MessagingExtensionActionResponse> {
///other code
const channelId = 123456
// Construct a conversation reference with the desired channel ID
const conversationReference = TurnContext.getConversationReference(
context.activity
);
conversationReference.conversation.id = channelId;
await context.sendActivity(sentCard);
return {};
}
I read this and other microsoft teams documentation, but I'm not sure which information I should follow. What I'm trying to do is very simple, just send the adaptive card to specific channel, but I'm confused because it's a lot of information all over the place and it's hard to find information that fits my scenario.
I appreciate any advice.
You can use like this:
await turnContext.sendActivity({ attachments: [userCard] });Please refer below sample: https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/msgext-message-reminder/nodejs/bots/teamsBot.js#L55