Node.js 使用facebook Graph API发送消息
我正在尝试使用POST方法向facebook用户发送消息: 以下是函数:Node.js 使用facebook Graph API发送消息,node.js,facebook-graph-api,http-post,Node.js,Facebook Graph Api,Http Post,我正在尝试使用POST方法向facebook用户发送消息: 以下是函数: router.post('/post/message/:userid', function (req, res, next) { messageData = { recipient: {id: req.params.userid}, message: {text:req.body.text} } console.log( messageData ); request({ url: '
router.post('/post/message/:userid', function (req, res, next) {
messageData = {
recipient: {id: req.params.userid},
message: {text:req.body.text}
}
console.log( messageData );
request({
url: 'https://graph.facebook.com/v2.6/'+ pageid +'/messages',
qs: {access_token: token_raw},
method: 'POST',
json: messageData
}, function (error, response, body) {
if (error) {
console.log('Error sending message: ', error);
} else if (response.body.error) {
console.log('Error: ', response.body.error);
}
});
});
但下面是控制台日志:
{ recipient: { id: '**ClientID**' },
message: { text: 'hello' } }
type: 'OAuthException',
Error: { message: '(#100) No matching user found',
code: 100,
fbtrace_id: 'FlDy9Ypfen8' }
而“ClientID”实际上是一个有效的用户ID
有什么想法吗