如何通过Facebook Messenger发送API发送Amazon S3上托管的图像? [英] How to send an image hosted on Amazon S3 through the Facebook Messenger Send API?

查看:136
本文介绍了如何通过Facebook Messenger发送API发送Amazon S3上托管的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Messenger Send API给我回响应 (#546)不允许您尝试附加的文件类型.请使用其他格式再试一次.错误代码:546,错误子代码:154502

The messenger Send API gives me back the response (#546) The type of file you're trying to attach isn't allowed. Please try again with a different format. error code: 546, error_subcode: 154502

但是,如果我在Google Cloud而不是Amazon S3上托管相同的确切映像,则该映像可以正常发送.

However, if I host the same exact image on Google Cloud instead of Amazon S3, then the image sends fine.

我到AWS映像的链接: https://s3.amazonaws.com/paloma -staging-public/files/conversation-step-56-80925.gif

My link to the AWS image: https://s3.amazonaws.com/paloma-staging-public/files/conversation-step-56-80925.gif

我到Google云映像的链接: https://storage.googleapis.com/callparty/thumbsup.gif

My link to the google cloud image: https://storage.googleapis.com/callparty/thumbsup.gif

是否有特殊原因导致指向S3上存储的图像的链接不能作为图像附件起作用,但是指向存储于Google云上的图像的链接可以起作用?

are there any special reasons that a link to an image stored on S3 would not work as an image attachment, but a link to an image stored on google cloud would work?

推荐答案

答案是,对于AWS链接,未设置文件的ContentType.

The answer was that for the AWS link the ContentType of the file was not set.

在上传到S3时,我必须手动设置文件的ContentType("image/gif","image/png"等),并且对于Google云存储,必须已自动设置.

While uploading to S3 I had to manually set the ContentType of the file appropriately ("image/gif", "image/png" etc.) and for the google cloud storage this must have been automatically set.

这就是为什么S3链接会导致自动下载,而Google云链接会在浏览器中显示图像的原因.

This is why the S3 link causes an auto-download, and the google cloud link displays the image in the browser.

这篇关于如何通过Facebook Messenger发送API发送Amazon S3上托管的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆