当Google Assistant在开发者预览中时,我已经成功地实现了通知,但在这个功能发布后,它们停止了工作。
jwtClient.authorize(function (err, tokens) {
let db = fbApp.database("https://[REDACTED].firebaseio.com/").ref();
//...
if (uid == undefined) {
res.status(404).send("Not found");
return
}
console.log(`Sending notification to ${uid}`)
let notif = {
userNotification: {
title: "this is test intent"
},
target: {
userId: uid,
intent: 'get_location'
}
}
requestLib.post('https://actions.googleapis.com/v2/conversations:send', {
'auth': {
'bearer': tokens.access_token
},
'json': true,
'body': { 'customPushMessage': notif, 'isInSandbox': true }
}, function(err,httpResponse,body) {
console.log(body);
res.status(httpResponse.statusCode).send(httpResponse.statusMessage);
});
});
响应为400:请求正文错误
{ error:
{ code: 400,
message: 'Target intent get_location is not a valid updatable intent. Please check that the intent has been configured for updates.',
status: 'INVALID_ARGUMENT' } }
我正在使用Dialogflow for intents,但找不到创建“有效的可更新意图”的位置