Forum Discussion

abdul_kareem_mohamme's avatar
abdul_kareem_mohamme
Copper Contributor
Oct 13, 2023

Webhook messages aren't delivered from azure functions

Webhook message delivery failed with error: Microsoft Teams endpoint returned HTTP error 400 with ContextId 01=2

 

Worked fine since last night. Today morning this error started. Nothing changed overnight. Is this a known bug?

8 Replies

  • Can you try sending the message using postman once and check you are getting the same error? Also please share the JSON so that we can check from our end as well.
    • abdul_kareem_mohamme's avatar
      abdul_kareem_mohamme
      Copper Contributor

      Meghana-MSFT 

       

       

      {
          "type": "message",
          "summary": "test",
          "attachments": [
              {
                  "contentType": "application/vnd.microsoft.card.adaptive",
                  "contentUrl": null,
                  "themeColor": "0072C6", 
                  "summary": "test",
                  "content": {
                      "type": "AdaptiveCard",
                      "body": [
                          {
                              "type": "TextBlock",
                              "size": "Large",
                              "weight": "Bolder",
                              "text": "test",
                              "wrap": true
                          },
                          {
                              "type": "TextBlock",
                              "size": "Large",
                              "weight": "Bolder",
                              "text": "messageTitle",
                              "wrap": true
                          },
                          {
                              "type": "TextBlock",
                              "size": "Medium",
                              "text": "asd",
                              "wrap": true
                          }
                      ],
                      "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
                      "version": "1.0",
                      "padding": "None",
                      "msteams": {
                          "width": "Full",
                          "entities": [
                              {
                                  "type": "mention",
                                  "text": "<at>MAK</at>",
                                  "mentioned": {
                                      "id": "email address removed for privacy reasons",
                                      "name": "name"
                                  }
                              }
                          ]
                      }
                  }
              }
          ]
      }
      • Meghana-MSFT's avatar
        Meghana-MSFT
        Icon for Microsoft rankMicrosoft

        abdul_kareem_mohamme - We checked this at our end, we made a change to the card to make sure it follows this pattern. It is working fine. - https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-format?tabs=adaptive-md%2Cdesktop%2Cconnector-html#user-mention-in-incoming-webhook-with-adaptive-cards

         

        We need to add "<at>Admin</at>"(Same as text property in entities) in text block of body so that it will show the @mention properly. We also replaced the text in entities block. Below is the final JSON.

         

         

        {
            "type": "message",
            "summary": "test",
            "attachments": [
                {
                    "contentType": "application/vnd.microsoft.card.adaptive",
                    "contentUrl": null,
                    "themeColor": "0072C6", 
                    "summary": "test",
                    "content": {
                        "type": "AdaptiveCard",
                        "body": [
                            {
                                "type": "TextBlock",
                                "size": "Large",
                                "weight": "Bolder",
                                "text": "test",
                                "wrap": true
                            },
                            {
                                "type": "TextBlock",
                                "size": "Large",
                                "weight": "Bolder",
                                "text": "messageTitle",
                                "wrap": true
                            },
                            {
                                "type": "TextBlock",
                                "size": "Medium",
                                "text": "Hi <at>Admin</at>",
                                "wrap": true
                            }
                        ],
                        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
                        "version": "1.0",
                        "padding": "None",
                        "msteams": {
                            "width": "Full",
                            "entities": [
                                {
                                    "type": "mention",
                                    "text": "<at>Admin</at>",
                                    "mentioned": {
                                        "id": "admin@M365x17798679.onmicrosoft.com",
                                        "name": "Admin"
                                    }
                                }
                            ]
                        }
                    }
                }
            ]
        }

         

         

        If you are still facing the issue even after making these changes, could you please share demo credentials where this issue is reproducible. Please share the credentials at microsoftteamsdev@microsoft.com.

Resources