Logic App -> MIcrosoft Teams: post an adaptive card and wait for response submit buttons no longer work

Paul Haag 26 Reputation points
2022-06-06T20:18:26.137+00:00

I created a Logic App that posts an adaptive card to Teams and waits for a response. Previously, this app was working, but after some unrelated edits to the workflow, the submit buttons no longer work in Teams. The adaptive card is posted and renders ok, but when the user clicks either of the submit buttons, it just hangs for a second and then does nothing (previously it would show the success message). The workflow is left in a Running status. I traced the HTTP traffic using Fiddler and I can see it posting the selected response to https://amer.ng.msg.teams.microsoft.com/v1/agents/xxxx and in both cases (a successful submission and the error), the server response looks the same (just a simple 200 with no response body). As far as I can tell, there's no error recorded either within Teams or within Logic Apps, so I'm not sure how to troubleshoot this further. Anyone have any ideas?

Here is the logic app definition:

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "If_driver_still_on_site": {
                "actions": {
                    "If_only_warning": {
                        "actions": {
                            "If_dispatcher_wants_to_contact_the_customer": {
                                "actions": {
                                    "If_email_specified": {
                                        "actions": {
                                            "If_the_dispatcher_edited_the_email_address": {
                                                "actions": {
                                                    "Write_back_the_updated_email_to_TMW": {
                                                        "inputs": {
                                                            "body": {
                                                                "companyId": "@triggerBody()?['CustomerCompanyId']",
                                                                "email": "@variables('Customer Email')",
                                                                "stopNumber": "@triggerBody()?['StopNumber']"
                                                            },
                                                            "host": {
                                                                "connection": {
                                                                    "name": "@parameters('$connections')['sql']['connectionId']"
                                                                }
                                                            },
                                                            "method": "post",
                                                            "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('default'))},@{encodeURIComponent(encodeURIComponent('default'))}/procedures/@{encodeURIComponent(encodeURIComponent('[dbo].[SEFA_UpdateDetentionEmail]'))}"
                                                        },
                                                        "runAfter": {},
                                                        "type": "ApiConnection"
                                                    }
                                                },
                                                "expression": {
                                                    "and": [
                                                        {
                                                            "not": {
                                                                "equals": [
                                                                    "@variables('Customer Email')",
                                                                    "@triggerBody()?['CustomerEmail']"
                                                                ]
                                                            }
                                                        }
                                                    ]
                                                },
                                                "runAfter": {
                                                    "Notify_dispatch_the_notification_was_sent": [
                                                        "Succeeded"
                                                    ]
                                                },
                                                "type": "If"
                                            },
                                            "Notify_dispatch_the_notification_was_sent": {
                                                "inputs": {
                                                    "body": {
                                                        "messageBody": "<p>Customer contacted.</p>",
                                                        "parentMessageId": "@{outputs('Post_adaptive_card_and_wait_for_a_response')['body/messageId']}",
                                                        "recipient": {
                                                            "channelId": "@variables('Channel ID')",
                                                            "groupId": "@variables('Team ID')"
                                                        }
                                                    },
                                                    "host": {
                                                        "connection": {
                                                            "name": "@parameters('$connections')['teams']['connectionId']"
                                                        }
                                                    },
                                                    "method": "post",
                                                    "path": "/v1.0/teams/conversation/replyWithMessage/poster/Flow bot/location/@{encodeURIComponent('Channel')}"
                                                },
                                                "runAfter": {
                                                    "Send_first_delay_notification_email": [
                                                        "Succeeded"
                                                    ]
                                                },
                                                "type": "ApiConnection"
                                            },
                                            "Send_first_delay_notification_email": {
                                                "inputs": {
                                                    "body": {
                                                        "Body": "<p>Order: @{triggerBody()?['OrderNumber']}<br>\nStop: @{triggerBody()?['StopCompanyName']}<br>\nRef #: @{triggerBody()?['ReferenceNumber']}<br>\n<br>\nDriver has arrived and been onsite for @{triggerBody()?['MinutesOnSiteMessage']} minutes. We have contacted the driver and unloading has not been completed.<br>\n<br>\nThank you!<br>\n<br>\n<span style=\"font-size: 14px\"><strong>The Dispatch Team</strong></span><br>\nOffice: 800.884.7332<br>\nEmail: dispatch@mycompany.com</p>",
                                                        "Importance": "Normal",
                                                        "ReplyTo": "dispatch@mycompany.com",
                                                        "Subject": "Delivery Delay - Ref #@{triggerBody()?['ReferenceNumber']}",
                                                        "To": "@variables('Customer Email')"
                                                    },
                                                    "host": {
                                                        "connection": {
                                                            "name": "@parameters('$connections')['office365']['connectionId']"
                                                        }
                                                    },
                                                    "method": "post",
                                                    "path": "/v2/Mail"
                                                },
                                                "runAfter": {},
                                                "type": "ApiConnection"
                                            },
                                            "Write_back_to_continue_contacting_the_customer": {
                                                "inputs": {
                                                    "body": {
                                                        "ContactCustomer": "Y",
                                                        "ProcessingStatus": "Complete"
                                                    },
                                                    "host": {
                                                        "connection": {
                                                            "name": "@parameters('$connections')['sql']['connectionId']"
                                                        }
                                                    },
                                                    "method": "patch",
                                                    "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('default'))},@{encodeURIComponent(encodeURIComponent('default'))}/tables/@{encodeURIComponent(encodeURIComponent('[dbo].[SEFA_DetainedStops]'))}/items/@{encodeURIComponent(encodeURIComponent(triggerBody()?['StopNumber']))}"
                                                },
                                                "runAfter": {
                                                    "If_the_dispatcher_edited_the_email_address": [
                                                        "Succeeded"
                                                    ]
                                                },
                                                "type": "ApiConnection"
                                            }
                                        },
                                        "else": {
                                            "actions": {
                                                "Notify_the_team_that_a_notification_could_not_be_sent": {
                                                    "inputs": {
                                                        "body": {
                                                            "messageBody": "<p>An email was not specified, so the customer was not contacted.</p>",
                                                            "parentMessageId": "@{outputs('Post_adaptive_card_and_wait_for_a_response')['body/messageId']}",
                                                            "recipient": {
                                                                "channelId": "@variables('Channel ID')",
                                                                "groupId": "@variables('Team ID')"
                                                            }
                                                        },
                                                        "host": {
                                                            "connection": {
                                                                "name": "@parameters('$connections')['teams']['connectionId']"
                                                            }
                                                        },
                                                        "method": "post",
                                                        "path": "/v1.0/teams/conversation/replyWithMessage/poster/Flow bot/location/@{encodeURIComponent('Channel')}"
                                                    },
                                                    "runAfter": {},
                                                    "type": "ApiConnection"
                                                },
                                                "Write_back_to_stop_contacting_the_customer_due_to_no_email": {
                                                    "inputs": {
                                                        "body": {
                                                            "ContactCustomer": "N",
                                                            "ProcessingStatus": "Complete"
                                                        },
                                                        "host": {
                                                            "connection": {
                                                                "name": "@parameters('$connections')['sql']['connectionId']"
                                                            }
                                                        },
                                                        "method": "patch",
                                                        "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('default'))},@{encodeURIComponent(encodeURIComponent('default'))}/tables/@{encodeURIComponent(encodeURIComponent('[dbo].[SEFA_DetainedStops]'))}/items/@{encodeURIComponent(encodeURIComponent(triggerBody()?['StopNumber']))}"
                                                    },
                                                    "runAfter": {
                                                        "Notify_the_team_that_a_notification_could_not_be_sent": [
                                                            "Succeeded"
                                                        ]
                                                    },
                                                    "type": "ApiConnection"
                                                }
                                            }
                                        },
                                        "expression": {
                                            "and": [
                                                {
                                                    "equals": [
                                                        "@not(equals(coalesce(trim(variables('Customer Email')),''),''))",
                                                        "@true"
                                                    ]
                                                }
                                            ]
                                        },
                                        "runAfter": {},
                                        "type": "If"
                                    }
                                },
                                "else": {
                                    "actions": {
                                        "Write_back_to_stop_contacting_the_customer": {
                                            "inputs": {
                                                "body": {
                                                    "ContactCustomer": "N",
                                                    "ProcessingStatus": "Complete"
                                                },
                                                "host": {
                                                    "connection": {
                                                        "name": "@parameters('$connections')['sql']['connectionId']"
                                                    }
                                                },
                                                "method": "patch",
                                                "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('default'))},@{encodeURIComponent(encodeURIComponent('default'))}/tables/@{encodeURIComponent(encodeURIComponent('[dbo].[SEFA_DetainedStops]'))}/items/@{encodeURIComponent(encodeURIComponent(triggerBody()?['StopNumber']))}"
                                            },
                                            "runAfter": {},
                                            "type": "ApiConnection"
                                        }
                                    }
                                },
                                "expression": {
                                    "and": [
                                        {
                                            "equals": [
                                                "@outputs('Post_adaptive_card_and_wait_for_a_response')['body/data/notifyCustomer']",
                                                "@true"
                                            ]
                                        }
                                    ]
                                },
                                "runAfter": {
                                    "Update_Customer_Email_from_dispatcher_value": [
                                        "Succeeded"
                                    ]
                                },
                                "type": "If"
                            },
                            "Post_adaptive_card_and_wait_for_a_response": {
                                "inputs": {
                                    "body": {
                                        "body": {
                                            "messageBody": "{\n    \"type\": \"AdaptiveCard\",\n    \"body\": [\n        {\n            \"type\": \"TextBlock\",\n            \"size\": \"medium\",\n            \"weight\": \"bolder\",\n            \"text\": \"Delivery Delayed\",\n            \"wrap\": true\n        },\n        {\n            \"type\": \"FactSet\",\n            \"facts\": [\n                {\n                    \"title\": \"Order\",\n                    \"value\": \"@{triggerBody()?['OrderNumber']}\"\n                },\n                {\n                    \"title\": \"Stop\",\n                    \"value\": \"@{triggerBody()?['StopCompanyName']}\"\n                },\n                {\n                    \"title\": \"Ref #\",\n                    \"value\": \"@{triggerBody()?['ReferenceNumber']}\"\n                },\n                {\n                    \"title\": \"Scheduled Earliest\",\n                    \"value\": \"@{formatDateTime(triggerBody()?['ScheduledEarliest'],'g')}\"\n                },\n                {\n                    \"title\": \"Scheduled Latest\",\n                    \"value\": \"@{formatDateTime(triggerBody()?['ScheduledLatest'],'g')}\"\n                },\n                {\n                    \"title\": \"Arrival Time\",\n                    \"value\": \"@{formatDateTime(triggerBody()?['ArrivalTime'],'g')}\"\n                },\n                {\n                    \"title\": \"Late?\",\n                    \"value\": \"@{if(equals(triggerBody()['ArrivedLate'],'1'),'**Yes**','No')}\"\n                }\n            ]\n        },\n        {\n            \"type\": \"TextBlock\",\n            \"text\": \"Driver @{triggerBody()?['DriverId']} (Phone Number @{triggerBody()?['DriverPhone']}) has arrived and exceeded @{triggerBody()?['MinutesOnSiteMessage']} minutes onsite. Please contact the driver to verify if he or she is being unloaded and expects to depart within the next @{triggerBody()?['MinutesOnSiteMessage']} minutes.\",\n            \"wrap\": true\n        }\n    ],\n    \"actions\": [\n        {\n            \"type\": \"Action.ShowCard\",\n            \"title\": \"I have contacted the driver\",\n            \"card\": {\n                \"type\": \"AdaptiveCard\",\n                \"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\",\n                \"version\": \"1.4\",\n                \"body\": [\n                    {\n                        \"type\": \"TextBlock\",\n                        \"text\": \"Do you want to notify the customer?\"\n                    },\n                    {\n                        \"type\": \"FactSet\",\n                        \"facts\": [\n                            {\n                                \"title\": \"Customer ID\",\n                                \"value\": \"@{triggerBody()?['CustomerCompanyId']}\"\n                            },\n                            {\n                                \"title\": \"Customer Name\",\n                                \"value\": \"@{triggerBody()?['CustomerCompanyName']}\"\n                            }\n                        ]\n                    },\n                    {\n                        \"id\": \"customerEmail\",\n                        \"type\": \"Input.Text\",\n                        \"label\": \"Confirm / enter customer email\",\n                        \"style\": \"email\",\n                        \"value\": \"@{variables('Customer Email')}\"\n                    }\n                ],\n                \"actions\": [\n                    {\n                        \"type\": \"Action.Submit\",\n                        \"title\": \"Yes\",\n                        \"data\": {\n                            \"notifyCustomer\": true\n                        }\n                    },\n                    {\n                        \"type\": \"Action.Submit\",\n                        \"title\": \"No\",\n                        \"data\": {\n                            \"notifyCustomer\": false\n                        }\n                    }\n                ]\n            }\n        }\n    ],\n    \"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\",\n    \"version\": \"1.4\"\n}",
                                            "recipient": {
                                                "channelId": "@variables('Channel ID')",
                                                "groupId": "@variables('Team ID')"
                                            },
                                            "updateMessage": "Thanks for your response!"
                                        },
                                        "notificationUrl": "@{listCallbackUrl()}"
                                    },
                                    "host": {
                                        "connection": {
                                            "name": "@parameters('$connections')['teams']['connectionId']"
                                        }
                                    },
                                    "path": "/v1.0/teams/conversation/gatherinput/poster/Flow bot/location/@{encodeURIComponent('Channel')}/$subscriptions"
                                },
                                "runAfter": {
                                    "Set_processing_status_to_waiting": [
                                        "Succeeded"
                                    ]
                                },
                                "type": "ApiConnectionWebhook"
                            },
                            "Record_send_initial_notification_interaction_details": {
                                "inputs": {
                                    "body": {
                                        "messageBody": "<p>Driver @{triggerBody()?['DriverId']} was delayed for order @{triggerBody()?['OrderNumber']}, stop @{triggerBody()?['StopNumber']} (@{triggerBody()?['StopCompanyName']}). Contact customer?: @{if(outputs('Post_adaptive_card_and_wait_for_a_response')['body/data/notifyCustomer'],'Yes','No')} (@{outputs('Post_adaptive_card_and_wait_for_a_response')['body/responder/displayName']})</p>",
                                        "parentMessageId": "@{outputs('Post_adaptive_card_and_wait_for_a_response')['body/messageId']}",
                                        "recipient": {
                                            "channelId": "@variables('Channel ID')",
                                            "groupId": "@variables('Team ID')"
                                        }
                                    },
                                    "host": {
                                        "connection": {
                                            "name": "@parameters('$connections')['teams']['connectionId']"
                                        }
                                    },
                                    "method": "post",
                                    "path": "/v1.0/teams/conversation/replyWithMessage/poster/Flow bot/location/@{encodeURIComponent('Channel')}"
                                },
                                "runAfter": {
                                    "Post_adaptive_card_and_wait_for_a_response": [
                                        "Succeeded"
                                    ]
                                },
                                "type": "ApiConnection"
                            },
                            "Set_processing_status_to_waiting": {
                                "inputs": {
                                    "body": {
                                        "ProcessingStatus": "Waiting"
                                    },
                                    "host": {
                                        "connection": {
                                            "name": "@parameters('$connections')['sql']['connectionId']"
                                        }
                                    },
                                    "method": "patch",
                                    "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('default'))},@{encodeURIComponent(encodeURIComponent('default'))}/tables/@{encodeURIComponent(encodeURIComponent('[dbo].[SEFA_DetainedStops]'))}/items/@{encodeURIComponent(encodeURIComponent(triggerBody()?['StopNumber']))}"
                                },
                                "runAfter": {},
                                "type": "ApiConnection"
                            },
                            "Update_Customer_Email_from_dispatcher_value": {
                                "inputs": {
                                    "name": "Customer Email",
                                    "value": "@{outputs('Post_adaptive_card_and_wait_for_a_response')['body/data/customerEmail']}"
                                },
                                "runAfter": {
                                    "Record_send_initial_notification_interaction_details": [
                                        "Succeeded"
                                    ]
                                },
                                "type": "SetVariable"
                            }
                        },
                        "else": {
                            "actions": {
                                "Send_second_delay_notification_email": {
                                    "inputs": {
                                        "body": {
                                            "Body": "<p>Order: @{triggerBody()?['OrderNumber']}<br>\nStop: @{triggerBody()?['StopCompanyName']}<br>\nRef #: @{triggerBody()?['ReferenceNumber']}<br>\n<br>\nDriver has arrived and been onsite for @{triggerBody()?['MinutesOnSiteMessage']} minutes.<br>\n<br>\nThank you!<br>\n<br>\n<span style=\"font-size: 14px\"><strong>The Dispatch Team</strong></span><br>\nOffice: 800.884.7332<br>\nEmail: dispatch@mycompany.com</p>",
                                            "Importance": "Normal",
                                            "ReplyTo": "dispatch@mycompany.com",
                                            "Subject": "Delivery Delay - Ref #@{triggerBody()?['ReferenceNumber']}",
                                            "To": "@variables('Customer Email')"
                                        },
                                        "host": {
                                            "connection": {
                                                "name": "@parameters('$connections')['office365']['connectionId']"
                                            }
                                        },
                                        "method": "post",
                                        "path": "/v2/Mail"
                                    },
                                    "runAfter": {},
                                    "type": "ApiConnection"
                                },
                                "Set_status_to_complete_after_second_notification": {
                                    "inputs": {
                                        "body": {
                                            "ProcessingStatus": "Complete"
                                        },
                                        "host": {
                                            "connection": {
                                                "name": "@parameters('$connections')['sql']['connectionId']"
                                            }
                                        },
                                        "method": "patch",
                                        "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('default'))},@{encodeURIComponent(encodeURIComponent('default'))}/tables/@{encodeURIComponent(encodeURIComponent('[dbo].[SEFA_DetainedStops]'))}/items/@{encodeURIComponent(encodeURIComponent(triggerBody()?['StopNumber']))}"
                                    },
                                    "runAfter": {
                                        "Send_second_delay_notification_email": [
                                            "Succeeded"
                                        ]
                                    },
                                    "type": "ApiConnection"
                                }
                            }
                        },
                        "expression": {
                            "and": [
                                {
                                    "equals": [
                                        "@triggerBody()?['NotificationCount']",
                                        "@'1'"
                                    ]
                                }
                            ]
                        },
                        "runAfter": {},
                        "type": "If"
                    }
                },
                "else": {
                    "actions": {
                        "Complete_process": {
                            "inputs": {
                                "body": {
                                    "ProcessingStatus": "Complete"
                                },
                                "host": {
                                    "connection": {
                                        "name": "@parameters('$connections')['sql']['connectionId']"
                                    }
                                },
                                "method": "patch",
                                "path": "/v2/datasets/@{encodeURIComponent(encod
Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
9,244 questions
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,899 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,919 questions
{count} votes

Accepted answer
  1. Bruno Lucas 4,411 Reputation points MVP
    2022-06-07T09:22:23.54+00:00

    Hi @Paul Haag ,

    Could be the compatibility/version changed?

    208968-image.png

    If you use the "https://adaptivecards.io/designer/" , the version will switch to 1.4 if not set to that value. It may be the optimum version.

    208959-image.png

    Is the card too complex? you can try replicate it with the "https://adaptivecards.io/designer/" and validate the syntax


0 additional answers

Sort by: Most helpful