Webhook image URL does not display correctly

Webhook image_url showing broken link.

I am using a channel webhook to send information from my Home Assistant to MatterMost.
The trigger in Home Assistant is motion on one of my security camera. What is supposed to happen is a message saying ‘Motion detected’ along with a picture from the camera.

I would expect to see the image and message instead I am getting the message and a broken link icon. When I download the image link I do see the correct image.

Two things:
#1 I would like the image to show up in the MM channel, not a link icon.
#2 I would like the image to be inbedded in the message and not just a link to the file. This is because the file in question is frequently updated, so might not be relavent to the message at the time of reading. (This is not a show stopper if it can not happen)

The webhook code is:
curl -i --insecure -X POST --data-urlencode 'payload={“attachments”: [
{
“fallback”: “test”,
“color”: “#ff8000”,
“text”: “Picture below.”,
“author_name”: “Home Assistant”,
“author_icon”: “https://mattermost.com/wp-contect-uploads/2022/02/icon_WS.png”,
“image_url”: “http://xx.xx.xx.xx:8123/local/tmp.porch.jpg”,
“title”: “Porch Motion Detected!”
}
]
} ’ https://<<>>/hooks/<<< My Channel Key >>>>

Observations:
A) The text and the Mattermost Icon all look as I expect. Only the picture from my server is broken icon.
B) If I copy the URL from Matter Most and past it into my web browser the picture is displayed.

Questions:
Is there a limit to the size of the picture MM can handle in a webhook like this?
Done it matter that I am downloading my picture using HTTP, and not HTTPS like the MM icon?

Any assistance would be great. First time writing a MatterMost web hook…

Hi Gregory,

Thank you for reaching out with your issue. It’s great to see you’re integrating Home Assistant with Mattermost using webhooks. Let’s see if we can resolve your issue together.

The behavior you’re reporting – getting the message with a broken link icon – generally happens when Mattermost can’t retrieve or properly handle the image at the provided URL (http://xx.xx.xx.xx:8123/local/tmp.porch.jpg). There might be a few reasons why this is occurring.

  1. Image Size: As you suspected, there might be a limit to the image size that Mattermost can handle. To verify this, could you try sending an image with smaller dimensions or file size and see if the problem persists?
  2. Image Accessibility: Mattermost might not be able to access your image due to network restrictions. It’s worth noting that while you can access the image URL from your browser, the Mattermost server might be in a different network context and may not have the same access.
  3. HTTP/HTTPS: The protocol used for your image (HTTP in this case) should not generally be an issue. However, depending on your Mattermost server’s configuration, it might only allow content from https URLs for security reasons.

To get to the bottom of this, you might also want to inspect your Mattermost server logs for any warning or error messages related to this operation. Those messages would likely provide more insights.

For embedding the image directly in the message rather than as a link, unfortunately, this might not be currently supported. As you noted, the image URL is fetched at the time of viewing, not when the webhook is called.

Don’t hesitate to let me know how your troubleshooting goes or if you have any further questions. We’re here to help!

Best,
~Mattermost AI Assistant :robot:

[Disclaimer: This was an AI assisted response powered by Mattermost AI. Were any of the above suggestions inaccurate? Let us know by replying to this comment!]