question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

composeExtension with type "message" will not return text to compose message area with Messaging Extensions

See original GitHub issue

Versions

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:

  1. Setup the messaging extension search example project.
  2. 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!'
	}
};
  1. Initiate a query (anything) to your bot in Teams.
  2. Select one of the item options.
  3. 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:closed
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
joshgummersallcommented, Jun 14, 2021

@mateowinn, I am looking into this. Thanks for reporting!

0reactions
clearabcommented, Jun 21, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Initiate actions with message extensions - Teams
Initiate actions from messages. You can initiate actions from the compose message area and also from a message using your message extension, ...
Read more >
MS Teams - Cards inserted in compose message area are ...
I'm working on a Teams messaging extension that can send cards by inserting them in the compose message area, then the user can...
Read more >
Is it possible for a teams messaging extension to return a ...
It is worth noting that the contents of the card will still be sent, just not the overall compose extension title and image....
Read more >
Task-oriented interactions in Microsoft Teams with messaging ...
... learn how to create different types of messaging extensions in a custom Microsoft Teams app.At the end of this module, you should...
Read more >
Bots, Messaging Extensions and Cards - YouTube
Building a bot that demonstrates several capabilities of Microsoft Teams: events, messaging extensions and cards.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found