Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with button action on unfurling link adaptive card #1264

Closed
rohannaik29 opened this issue May 15, 2024 · 5 comments
Closed

Issue with button action on unfurling link adaptive card #1264

rohannaik29 opened this issue May 15, 2024 · 5 comments
Assignees

Comments

@rohannaik29
Copy link

I have developed a Message Extension Teams app that includes a feature for link unfurling. Upon pasting the link, an adaptive card containing a button shows up in the chat. Generally, I want to popup a dialog that opens upon clicking the button and accepts text from users. But, on clicking the button, I'm getting the error "Return to the main window to perform this action." How can I fix this issue?

public async handleTeamsAppBasedLinkQuery(
    context: TurnContext,
    query: AppBasedLinkQuery
  ): Promise<MessagingExtensionResponse> {
    const previewCard = CardFactory.thumbnailCard("Preview Card", query.url);
    const card = await this.adaptiveCard(context);
    const attachment = { ...card, preview: previewCard };

    return {
      composeExtension: {
        type: "result",
        attachmentLayout: "list",
        attachments: [attachment],
        suggestedActions: {
          actions: [
            {
              title: "default",
              type: "setCachePolicy",
              value: '{"type":"no-cache"}'
            }
          ]
        }
      }
    };
  }

Adaptive Card for unfurling card:

function adaptiveCard(){
return { 
    "$schema": "https://adaptivecards.io/schemas/adaptive-card.json", 
    "type": "AdaptiveCard", 
    "version": "1.6", 
    "body": [ 
        { 
            "type": "TextBlock", 
            "text": "text", 
            "wrap": true 
        } 
    ], 
    "actions": [ 
        { 
            "type": "Action.Submit", 
            "title": "Login", 
            "data": { 
                "msteams": { 
                    "type": "task/fetch" 
                }, 
                "data": "onLogin" 
            } 
        }
    ]
}
}
@Prasad-MSFT
Copy link

Thanks for raising your issue. We will check this at our end and will update you accordingly.

@Meghana-MSFT
Copy link

This is by design behavior. Please note that certain button actions are not actionable when card is in the compose box. Action.Submit, Action.Execute do not work where as Action.OpenUrl works when the card is in compose box in preview mode. It works fine once the card is sent.

linkunfurlButtonActionIssue.mp4

@rohannaik29
Copy link
Author

Thank you so much :)

@ChetanSharma-msft
Copy link
Collaborator

We are closing this issue for now, please feel free to reopen it, if required.

Tell us about your experience!

Hi @rohannaik29! This issue is closed in our system. We would like your feedback on your experience with our support team and Platform.

Best regards,
Teams Platform

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants