composeExtension with type "message" will not return text to compose message area with Messaging Extensions
See original GitHub issueVersions
What package version of the SDK are you using: 4.11.1 What nodejs version are you using: 12.14.0 What browser version are you using: n/a, MacOS Teams app What os are you using: MacOS
Describe the bug
The MS docs (and even this library’s in-line code comments) seem to indicate that it is possible to return plaintext to a user’s compose message area with Messaging Extensions if you specify text
and type: 'message'
in the composeExtension
return value of the handleTeamsMessagingExtensionSelectItem
method in TeamsActivityHandler
, like so:
async handleTeamsMessagingExtensionSelectItem(context, obj) {
return {
composeExtension: {
type: 'message',
text: 'Here is the message you want to send to your friends!'
}
};
}
Unfortunately, while no error is thrown and the value is seemingly returned to the client app, nothing ever shows up. I can get the regular card attachment behavior, i.e.
async handleTeamsMessagingExtensionSelectItem(context, obj) {
return {
composeExtension: {
type: 'result',
attachmentLayout: 'list',
attachments: [CardFactory.thumbnailCard(obj.description)]
}
};
}
to work just fine, but never plaintext. Perhaps I am missing some key piece because there are no definitive examples for this usage?
To Reproduce
Steps to reproduce the behavior:
- Setup the messaging extension search example project.
- Replace the contents of
handleTeamsMessagingExtensionSelectItem
in/bots/teamsMessagingExtensionsSearchBot.js
with
return {
composeExtension: {
type: 'message',
text: 'Here is the message you want to send to your friends!'
}
};
- Initiate a query (anything) to your bot in Teams.
- Select one of the item options.
- Wait for nothing to happen.
Expected behavior
I would expect the text “Here is the message you want to send to your friends!” to populate my compose message area much the same way that Cards can populate there before hitting the Send button, but nothing happens at all.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (5 by maintainers)
@mateowinn, I am looking into this. Thanks for reporting!
No, in this case Teams will just ignore the payload and do nothing.
You can find the JSON payloads on the JSON tab of any Teams bot documentation page that has code samples. An example is here: https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/conversations/conversation-messages?tabs=json