Forum Discussion

ameenv's avatar
ameenv
Copper Contributor
Dec 14, 2023
Solved

Unable to send an image attachment to the incoming webhook in Teams

We have a teams bot app, as well as an integration with incoming webhook.  The usecase here is, to send an image to a teams channel using incoming webhook.  Its working fine when we send the im...
  • Prasad_Das-MSFT's avatar
    Dec 14, 2023

    ameenv - To send an image to a Teams channel using an incoming webhook, you can include the image as an attachment in the Adaptive Card payload. 

    {
      "type": "message",
      "attachments": [
        {
          "contentType": "application/vnd.microsoft.card.adaptive",
          "content": {
            "type": "AdaptiveCard",
            "body": [
              {
                "type": "ActionSet",
                "actions": [
                  {
                    "type": "Action.OpenUrl",
                    "title": "View in Datafi",
                    "style": "default",
                    "role": "Link",
                    "url": "https://abc.us",
                    "tooltip": "View in abc"
                  }
                ]
              },
              {
                "type": "Image",
                "url": "data:image/jpeg;base64,/xxxxxxxx"
              }
            ],
            "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
            "version": "1.0"
          }
        }
      ]
    }
    

    In this example, the image is included as an attachment of type "Image" with the URL set to the base64 encoded image data. Make sure to replace /xxxxxxxx with the actual base64 encoded image data.

     

     

     

    Thanks, 

    Prasad Das

    ------------------------------------------------------------------------------------------ 

    If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate. 

Resources