使用api.ai和heroku(node.js)的Facebook Messenger Messenger聊天室中的OAuthexception

我已经分享了我的代码和下面popup的错误。 基本上,我跟着教程http://www.girliemac.com/blog/2017/01/06/facebook-apiai-bot-nodejs/和另一个。 我的chatbot适用于smalltalk,但不适合天气api的东西。 我试图让聊天机器人给我关于不同城市天气的答案。 我完全按照教程。

Error: { message: '(#100) No matching user found', type: 'OAuthException', code: 100, error_subcode: 2018001, fbtrace_id: 'DeubaTWU6Gg' } Error: { message: '(#100) No matching user found', type: 'OAuthException', code: 100, error_subcode: 2018001, fbtrace_id: 'FSiMes3IwHv' } 

//代码来自index.js只是天气api的东西

  app.post('/ai', (req, res) => { //console.log('*** Webhook for api.ai query ***'); //console.log(req.body.result); if (req.body.result.action === 'weather') { // console.log('*** weather ***'); let city = req.body.result.parameters['geo-city']; let restUrl = 'http://api.openweathermap.org/data/2.5/weather?APPID='+process.env.WEATHER_API_KEY+'&q='+city; request.get(restUrl, (err, response, body) => { if (!err && response.statusCode == 200) { let json = JSON.parse(body); // console.log(json); let tempF = ~~(json.main.temp * 9/5 - 459.67); let tempC = ~~(json.main.temp - 273.15); let msg = 'The current condition in ' + json.name + ' is ' + json.weather[0].description + ' and the temperature is ' + tempF + ' ℉ (' +tempC+ ' ℃).' return res.json({ speech: msg, displayText: msg, source: 'weather' }); } else { let errorMessage = 'I failed to look up the city name.'; return res.status(400).json({ status: { code: 400, errorType: errorMessage } }); } }) } }); 

我该如何解决这个错误?

错误是因为您使用recipient.id的消息发送的页面范围ID无效。 假设你已经从教程中设置了sendMessage()函数,很可能问题在于你正在使用与bot聊天的Facebook帐号没有适当的angular色。

如果机器人不公开(即未提交和批准),则用于向机器人发送消息的Facebook帐户必须被授予pipe理员,开发人员或testing人员angular色。