[英]Error while sending media stored on Google Drive using WhatsApp API
I'm trying to send a image stored Google Drive via WhatsApp API using 360Dialog, I did set the provider as instructed in https://developers.facebook.com/docs/whatsapp/api/settings/media-providers#example-2 I'm trying to send a image stored Google Drive via WhatsApp API using 360Dialog, I did set the provider as instructed in https://developers.facebook.com/docs/whatsapp/api/settings/media-providers#example-2
POST /v1/settings/application/media/providers
[{
"name": "google-drive",
"type": "www",
"config": {
"bearer": "your-bearer-token" #(Replaced the value here with API KEY)
}
}
]
and it successfully returns the provider information, but when I execute the code它成功返回提供者信息,但是当我执行代码时
import requests
import json
url = "" #360Dialog url
payload = json.dumps({
"recipient_type": "individual",
"to": "",
"type": "image",
"image": {
"link": "", #I've set the link key as the URL of the image I have on my google drive
"provider": {
"name": "google-drive"
},
"caption": "your-image-caption"
}
})
headers = {
'D360-API-KEY': '',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Error:错误:
"errors": [
{
"code": 1000,
"title": "Image file format (text/html) is not supported"
}
]
Have you tested with other image sources?您是否使用其他图像源进行了测试? It seems like Google Drive is giving you a web view of the image instead of the physical image itself... Thats why the error says that you should provide an image format and not a
text/html
in the response header of the image source.似乎 Google Drive 正在为您提供图像的 web 视图而不是物理图像本身......这就是为什么错误说您应该在图像源的响应 header 中提供图像格式而不是
text/html
的原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.