Facebook messenger api发送视频消息

时间:2016-04-14 06:22:34

标签: javascript facebook video messenger facebook-chat

是否可以使用Facebook的新信使API发送视频消息?

我尝试使用此代码:

function sendVideo(sender)
messageData = {
            "attachment":{
                "type":'video',
                "payload":{
                    "url":"https://scontent.xx.fbcdn.net/hphotos-xpa1/v/t35.0-12/12986901_10156932107880294_1613469135_o.jpg?oh=096aca0f851bd58ee11959982cba1f0d&oe=57114D35"
                }       
            }
        }
    request({
        url: 'https://graph.facebook.com/v2.6/me/messages',
        qs: {access_token:token},
        method: 'POST',
        json: {
        recipient: {id:sender},
            message: messageData,
            }
    }, function(error, response, body) {
        if (error) {
        console.log('Error sending message: ', error);
        } else if (response.body.error) {
        console.log('Error: ', response.body.error);
        }
    });
 }

但是通过打印日志,我收到以下错误:

Error:  { message: '(#2) Temporary send message failure. Please try again later',
2016-04-14T06:11:39.509376+00:00 app[web.1]:   type: 'OAuthException',
2016-04-14T06:11:39.509377+00:00 app[web.1]:   is_transient: true,
2016-04-14T06:11:39.509378+00:00 app[web.1]:   code: 2,
2016-04-14T06:11:39.509379+00:00 app[web.1]:   fbtrace_id: 'GsTH+2P70rB' }

谢谢!

1 个答案:

答案 0 :(得分:0)

根据Messenger文档,其可能的附件类型可能是图像或模板。

https://developers.facebook.com/docs/messenger-platform/send-api-reference