SOLVED

Adaptive Card button should return "MessagingExtensionActionResponse"

Occasional Contributor

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?

1 Reply
best response confirmed by maheshkumargunasekaran (Occasional Contributor)
Solution

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.onteams...

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-ext....

Thanks