Messenger not displaying images in Generic template in mobile App
Asked Answered
U

5

6

I'm sending Facebook a structured message with a URL to an image file (the file is in Amazon S3). The message is structured according to https://developers.facebook.com/docs/messenger-platform/send-api-reference/generic-template (Generic template).

The message is being received and shown just fine - but the image doesn't appear in the mobile iOS Messenger app (I didn't test Android). It DOES appear in the web version of Messenger.

Anyone know what can cause this?

Thanks in advance!

Ultramontanism answered 28/7, 2016 at 14:55 Comment(0)
L
1

This happens in iOS Messenger app when there is no subdomain in the URL of the image.

In my case, I change from https://example.com/image.jpg to https://mysub.example.com/image.jpg and the problem is solved.

Laryngology answered 8/7, 2017 at 7:50 Comment(0)
A
1

This happens because Facebook caches images by their URL. Let's say you're trying to send an image at URL http://example.org/image.png in your generic template.

When you make a call to the Send API, FB attempts to loads the image from http://example.org/image.png. When you send the same image in the future FB uses their cached version instead of reloading it from your endpoint. If this endpoint fails to serve the image correctly at the first send, FB will continue to cache / render a blank image.

I encountered this and fixed it by doing the following:

  1. Make sure my image could be accessed at http://example.org/image.png

  2. Add a URL parameter for the image_url in your call to FB API. Use http://example.org/image.png?time=1524606955198

Hopefully your image starts showing up.

Abigail answered 24/4, 2018 at 22:2 Comment(0)
S
0

I think the structured message templates are not working on iOS right now. (at least not for me)

Seidler answered 1/8, 2016 at 8:23 Comment(0)
G
0

I had the same image loading issue on mobile applications. I found out the problematic image file names had whitespaces in it. Try replacing the spaces with '-' or '_' and check.

Galven answered 10/8, 2016 at 17:49 Comment(0)
U
-1

OK, so here's the deal:

The URL is to an Amazon S3 bucket (like I said in the question). It turns out that the Facebook server wasn't able to validate the SSL certificate for the S3 bucket. I don't know why it worked on the web version, but that's what Facebook support said.

Anyway, after searching online I found that the URL to an S3 bucket may cause problems with SSL certificates if there are dots (".") in the bucket name (see http://shlomoswidler.com/2009/08/amazon-s3-gotcha-using-virtual-host.html). And I did name it with dots.

I renamed the bucket and everything's fine. So remember: don't name your S3 buckets with something like my.new.bucket.

Yariv.

Ultramontanism answered 2/8, 2016 at 16:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.