microsoft / AdaptiveCards

A new way for developers to exchange card content in a common and consistent way.
https://adaptivecards.io
MIT License
1.74k stars 543 forks source link

Adaptive Card doesn't render in Telegram #1253

Closed samueleorfei closed 4 years ago

samueleorfei commented 6 years ago

When the bot send the adaptive card (with textbox, text input, choice set and submit buttons), the Telegram channel returns "can't parse inline keyboard button: Text buttons are unoallowed in the inline keyboard".

eanders-ms commented 6 years ago

Hi @samueleorfei, can you provide an example adaptive card for repro?

samueleorfei commented 6 years ago

This is the adaptive card in the bot chat emulator adaptivecard

This is Telegram's error 5854963018239159559_ 0

matthidinger commented 6 years ago

@samueleorfei could you please select that card in the emulator and paste the JSON here

samueleorfei commented 6 years ago

    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "contentType": "application/vnd.microsoft.card.adaptive",
    "content": {
        "type": "AdaptiveCard",
        "version": "1.0",
        "body": [{
            "type": "Container",
            "items": [{
                "type": "Container",
                "items": [{
                        "type": "ColumnSet",
                        "columns": [{
                                "type": "Column",
                                "width": "auto",
                                "items": [{
                                    "type": "TextBlock",
                                    "weight": "bolder",
                                    "size": "large",
                                    "text": "Name:",
                                    "wrap": true
                                }]
                            },
                            {
                                "type": "Column",
                                "width": "stretch",
                                "items": [{
                                    "type": "Input.Text",
                                    "id": "Name",
                                    "placeholder": "Name"
                                }]
                            }
                        ]
                    },
                    {
                        "type": "ColumnSet",
                        "columns": [{
                                "type": "Column",
                                "width": "auto",
                                "items": [{
                                    "type": "TextBlock",
                                    "weight": "bolder",
                                    "size": "large",
                                    "wrap": true,
                                    "text": "Surname:"
                                }]
                            },
                            {
                                "type": "Column",
                                "width": "stretch",
                                "items": [{
                                    "type": "Input.Text",
                                    "id": "Surname",
                                    "placeholder": "Surname"
                                }]
                            }
                        ]
                    },
                    {
                        "type": "ColumnSet",
                        "columns": [{
                                "type": "Column",
                                "width": "auto",
                                "items": [{
                                    "type": "TextBlock",
                                    "weight": "bolder",
                                    "size": "large",
                                    "wrap": true,
                                    "text": "Email:"
                                }]
                            },
                            {
                                "type": "Column",
                                "width": "stretch",
                                "items": [{
                                    "type": "Input.Text",
                                    "id": "Email",
                                    "placeholder": "Contact email"
                                }]
                            }
                        ]
                    },
                    {
                        "type": "ColumnSet",
                        "columns": [{
                                "type": "Column",
                                "width": "auto",
                                "items": [{
                                    "type": "TextBlock",
                                    "text": "Title:",
                                    "wrap": true,
                                    "weight": "bolder",
                                    "size": "large"
                                }]
                            },
                            {
                                "type": "Column",
                                "width": "stretch",
                                "items": [{
                                    "type": "Input.Text",
                                    "id": "Title",
                                    "placeholder": "Problem's title"
                                }]
                            }
                        ]
                    },
                    {
                        "type": "ColumnSet",
                        "columns": [{
                                "type": "Column",
                                "width": "auto",
                                "items": [{
                                    "type": "TextBlock",
                                    "text": "Description:",
                                    "wrap": true,
                                    "weight": "bolder",
                                    "size": "large"
                                }]
                            },
                            {
                                "type": "Column",
                                "width": "stretch",
                                "items": [{
                                    "type": "Input.Text",
                                    "isMultiline": true,
                                    "id": "Description",
                                    "placeholder": "Problem's description"
                                }]
                            }
                        ]
                    },
                    {
                        "type": "ColumnSet",
                        "columns": [{
                                "type": "Column",
                                "width": "auto",
                                "items": [{
                                    "type": "TextBlock",
                                    "text": "Priority:",
                                    "wrap": true,
                                    "weight": "bolder",
                                    "size": "large"
                                }]
                            },
                            {
                                "type": "Column",
                                "width": "stretch",
                                "items": [{
                                    "type": "Input.ChoiceSet",
                                    "id": "Priority",
                                    "style": "compact",
                                    "value": "Low",
                                    "isMultiSelect": false,
                                    "choices": [{
                                            "title": "High",
                                            "value": "High"
                                        },
                                        {
                                            "title": "Medium",
                                            "value": "Medium"
                                        },
                                        {
                                            "title": "Low",
                                            "value": "Low"
                                        }
                                    ]
                                }]
                            }
                        ]
                    },
                    {
                        "type": "ColumnSet",
                        "columns": [{
                                "type": "Column",
                                "width": "auto",
                                "items": [{
                                    "type": "TextBlock",
                                    "text": "Company:",
                                    "wrap": true,
                                    "weight": "bolder",
                                    "size": "large"
                                }]
                            },
                            {
                                "type": "Column",
                                "width": "stretch",
                                "items": [{
                                    "type": "Input.ChoiceSet",
                                    "id": "Company",
                                    "style": "expanded",
                                    "value": "",
                                    "isMultiSelect": false,
                                    "choices": [{
                                            "title": "Val1",
                                            "value": "Val1"
                                        },
                                        {
                                            "title": "Val2",
                                            "value": "Val2"
                                        },
                                        {
                                            "title": "Val3",
                                            "value": "Val3"
                                        }
                                    ]
                                }]
                            }
                        ]
                    },
                    {
                        "type": "ColumnSet",
                        "columns": [{
                                "type": "Column",
                                "width": "auto",
                                "items": [{
                                    "type": "TextBlock",
                                    "text": "Specify:",
                                    "wrap": true,
                                    "weight": "bolder",
                                    "size": "large"
                                }]
                            },
                            {
                                "type": "Column",
                                "width": "stretch",
                                "items": [{
                                    "type": "Input.Text",
                                    "id": "Specify",
                                    "placeholder": "Specify Company"
                                }]
                            }
                        ]
                    }
                ]
            }]
        }],
        "actions": [{
            "type": "Action.Submit",
            "title": "Next"
        }]
    }
}```
eanders-ms commented 6 years ago

Thanks @samueleorfei. I'll post back here after some investigation.

eanders-ms commented 6 years ago

@samueleorfei your Adaptive Card JSON has some errors. You can edit and validate your JSON using the Adaptive Card visualizer: http://adaptivecards.io/visualizer/index.html.

I wonder if correcting these errors will allow it to render in Telegram.

paulcam206 commented 4 years ago

No action on this one in a long time. Please reactivate if your issue isn't resolved.

ghost commented 4 years ago

Hi Im experiencing the same issue. Where my Adaptive Card renders fine in the Emulator and Web Chat 1 2

bot doesn't seem to work in Telegram.

{ "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "type": "AdaptiveCard", "version": "1.3", "body": [ { "type": "Image", "url": "https://i.ibb.co/b2xtqWX/SIMONLOGO.png", "size": "Stretch" }, { "type": "TextBlock", "size": "Large", "weight": "Bolder", "text": "Welcome to Simon", "wrap": true, "maxLines": 0, "horizontalAlignment": "Center" } ], "actions": [ { "type": "Action.OpenUrl", "title": "Homepage", "url": "https://adaptivecards.io/designer/", "style": "positive" } ] }

matthidinger commented 4 years ago

Hi @LinusUngerer, Bot Framework channels are currently on version 1.2 of the Adaptive Card Schema. Can you change your version property to 1.2.

This can also be changed in the Designer in the top right

image

ghost commented 4 years ago

Hi @matthidinger I have done so and have gotten some cards working now however any cards I try with any clickable buttons be that on an image or open URL button. Doesn't seem to work. It doesn't come through on the chat and the bot then ends up hanging and crashing. Is there a reason for this or something I could fix?

utkarshthinkaxis commented 2 years ago

I am also facing the same issue in the telegram channel for the simple adaptive cards. Its rendered as an Image in version 1.2.