Forum Discussion
maheshkumargunasekaran
Sep 02, 2021Copper Contributor
Adaptive Card button should return "MessagingExtensionActionResponse"
Hi All,
Our application used to send notification to MS Teams users via bot. The application has been developed through C#. We have created a button with the below code.
Actions =
{
new AdaptiveSubmitAction()
{
Type = AdaptiveSubmitAction.TypeName,
Title = "Click Here",
},
},
By default, it invoked OnMessageActivityAsync(). Later we have added below piece of code in the button property.
Data = new TaskModuleDetail<string>() { Data = "SignIn", CommandId = "SignIn" },
In the class file of TaskModuleDetail, we have defined the Type as below.
public object Type { get; set; } = JsonConvert.DeserializeObject("{\"type\": \"task/fetch\" }");
Hence it is redirecting to OnTeamsTaskModuleFetchAsync().
But am expecting the click event of button should hit OnTeamsMessagingExtensionFetchTaskAsync() which returns MessagingExtensionActionResponse as i need to do launch an URL and perform authentication.
Could someone help me to fix it?
Hi, I don't think you can can trigger OnTeamsMessagingExtensionFetchTaskAsync() on submit of adaptive card button. This method is invoked when we try to trigger messaging extension. https://docs.microsoft.com/en-us/dotnet/api/microsoft.bot.builder.teams.teamsactivityhandler.onteamsmessagingextensionfetchtaskasync?view=botbuilder-dotnet-stable
Messaging extension can only be triggered from compose box, search bar or message actions. You can refer below document.
https://docs.microsoft.com/en-us/microsoftteams/platform/messaging-extensions/what-are-messaging-extensions#:~:text=The%20invoke%20locations%20are%20compose,the%20next%20interaction%20to%20enable.
Thanks
- Prithvi-MSFT
Microsoft
Hi, I don't think you can can trigger OnTeamsMessagingExtensionFetchTaskAsync() on submit of adaptive card button. This method is invoked when we try to trigger messaging extension. https://docs.microsoft.com/en-us/dotnet/api/microsoft.bot.builder.teams.teamsactivityhandler.onteamsmessagingextensionfetchtaskasync?view=botbuilder-dotnet-stable
Messaging extension can only be triggered from compose box, search bar or message actions. You can refer below document.
https://docs.microsoft.com/en-us/microsoftteams/platform/messaging-extensions/what-are-messaging-extensions#:~:text=The%20invoke%20locations%20are%20compose,the%20next%20interaction%20to%20enable.
Thanks