Mar 29 2024 12:49 AM
I want the message to be directly inserted into the chat. Microsoft documentation says,
"If the message extension is invoked from the compose box or directly from a message, your web service can insert the final response directly into the channel or chat. In this case, the Adaptive Card comes from the bot, the bot updates it, and replies to the conversation thread if needed. You must add the bot object to the app manifest using the same ID and defining the appropriate scopes."
But I have no idea how to do this. Yes, we will add the bot to manifest, what next?
Currently, I am returning my adaptive card using the following code :
async handleTeamsMessagingExtensionSubmitAction(context, action) {
switch (action.commandId) {
case "executeActions":
return await executeActions(context, action);
default:
throw new Error("NotImplemented");
}
}
async function executeActions(context, action) {
const data = action.data;
const adaptiveCard = createAdaptiveCard(data);
const attachment = {
contentType: adaptiveCard.contentType,
content: adaptiveCard.content,
preview: adaptiveCard,
};
return {
composeExtension: {
type: "result",
attachmentLayout: "list",
attachments: [attachment],
}
}
};
Could someone please help how can I tweak the codes, to send messages into the chat directly? So that, the user should not have to click on send every time. I don't mind if the message comes from a bot, into the chat.