Forum Discussion

benjamin-error's avatar
benjamin-error
Copper Contributor
Apr 09, 2025

Adaptive Card in Declarative Agent not rendering

My declarative agent does not render an adaptive card as I expect it to: 

My agent works this way:

  1. a user ask the agent to generate something
  2. this triggers a function that makes a POST Api call to my API
  3. the api responds with json data
  4. the Agent should display this data as an adaptive card. But it doesn't

This is my plugin.json

{
    "$schema": "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.2/schema.json",
    "schema_version": "v2.2",
    "name_for_human": "SOMETHING",
    "description_for_human": "SOMETHING",
    "namespace": "SOMETHING",
    "functions": [
        {
            "name": "generateSomething",
            "description": "Generates something.",
            "capabilities": {
                "response_semantics": {
                    "data_path": "$",
                    "properties": {
                        "title": "$.title",
                        "subtitle": "$.number",
                        "url": "$.image_url"
                    },
                    "static_template": {
                        "type": "AdaptiveCard",
                        "body": [
                            {
                                "type": "TextBlock",
                                "size": "default",
                                "weight": "default",
                                "text": "${number}"
                            },
                            {
                                "type": "TextBlock",
                                "size": "medium",
                                "weight": "bolder",
                                "text": "Title: ${title}"
                            },
                            {
                                "type": "Image",
                                "style": "Person",
                                "url": "${image_url}",
                                "altText": "image",
                                "size": "Stretch"
                            }
                        ],
                        "actions": [
                            {
                                "type": "Action.OpenUrl",
                                "title": "View",
                                "url": "${view_url}"
                            }
                        ],
                        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
                        "version": "1.5"
                    }
                },
                "confirmation": {
                    "type": "AdaptiveCard",
                    "title": "Create something",
                    "body": "Do you want to create something?"
                  }
            }
        }
    ],
    "runtimes": [
        {
            "type": "OpenApi",
            "auth": {
                "type": "None"
            },
            "spec": {
                "url": "apiSpecificationFile/openapi_1.json"
            },
            "run_for_functions": [
                "generateSomething"
            ]
        }
    ],
    "capabilities": {
        "conversation_starters": [
            {
                "text": "Generate Something"
            }
        ]
    }
}



This is an example payload from my API:

{
    "image_url": "https://some.url",
    "view_url": "https://something.else",
    "title": "Las Vegas",
    "number": 1
}

 

No RepliesBe the first to reply

Resources