无法使用 Twilio Whatsapp 沙盒 API 发送媒体?
Failing to send media with Twilio Whatsapp Sandbox API?
无法使用 CURL
通过 Twilio WhatsApp API 发送媒体,我只收到短信,但媒体丢失。
我一直在浏览 Twilio 文档以发送媒体文件。命令正确完成,但在我的 phone 上,我只收到消息 Send Media with Twilio
curl -X POST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXX/Messages.json --data-urlencode "To=whatsapp:+263000000" --data-urlencode "From=whatsapp:+14155238886" --data-urlencode "Body=Thanks for contacting me on WhatsApp! Here is a picture of an owl." --data-urlencode “MediaUrl=https://demo.twilio.com/owl.png” -u "ACXXXXXXXXXXXXXXXXXXXx:authkey"
它应该将 owl 的图像文件发送给 WhatsApp 中的收件人。
此处为 Twilio 开发人员布道师。
我使用了来自 WhatsApp Media Support blog post and the Support page. This recreated your error: the numMedia
Message property did not exist, but the message sent. A Message SID existed, but when I visited the subresource media URI, it said the requested resource was not found, status 404, and it gave this 20404 错误页面的 cURL 代码。
我发现将图片 URL 周围的双引号切换为单引号以发送图像(使 numMedia
和子资源媒体 URI 存在。在单引号之后,使用双引号围绕媒体 URL 也起作用了,所以发送了一张图片。
curl -X POST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXX/Messages.json --data-urlencode "To=whatsapp:+263000000" --data-urlencode "From=whatsapp:+14155238886" --data-urlencode "Body=Thanks for contacting me on WhatsApp! Here is a picture of an owl." --data-urlencode 'MediaUrl=https://demo.twilio.com/owl.png' -u "ACXXXXXXXXXXXXXXXXXXXx:authkey"
希望对您有所帮助!
无法使用 CURL
通过 Twilio WhatsApp API 发送媒体,我只收到短信,但媒体丢失。
我一直在浏览 Twilio 文档以发送媒体文件。命令正确完成,但在我的 phone 上,我只收到消息 Send Media with Twilio
curl -X POST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXX/Messages.json --data-urlencode "To=whatsapp:+263000000" --data-urlencode "From=whatsapp:+14155238886" --data-urlencode "Body=Thanks for contacting me on WhatsApp! Here is a picture of an owl." --data-urlencode “MediaUrl=https://demo.twilio.com/owl.png” -u "ACXXXXXXXXXXXXXXXXXXXx:authkey"
它应该将 owl 的图像文件发送给 WhatsApp 中的收件人。
此处为 Twilio 开发人员布道师。
我使用了来自 WhatsApp Media Support blog post and the Support page. This recreated your error: the numMedia
Message property did not exist, but the message sent. A Message SID existed, but when I visited the subresource media URI, it said the requested resource was not found, status 404, and it gave this 20404 错误页面的 cURL 代码。
我发现将图片 URL 周围的双引号切换为单引号以发送图像(使 numMedia
和子资源媒体 URI 存在。在单引号之后,使用双引号围绕媒体 URL 也起作用了,所以发送了一张图片。
curl -X POST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXX/Messages.json --data-urlencode "To=whatsapp:+263000000" --data-urlencode "From=whatsapp:+14155238886" --data-urlencode "Body=Thanks for contacting me on WhatsApp! Here is a picture of an owl." --data-urlencode 'MediaUrl=https://demo.twilio.com/owl.png' -u "ACXXXXXXXXXXXXXXXXXXXx:authkey"
希望对您有所帮助!