通知(每日更新)不适用于谷歌家庭迷你设备

时间:2018-03-23 17:39:26

标签: actions-on-google dialogflow google-home proactive

我在对话框流程上创建了一个应用并部署在Google助手上, 它在移动助理和谷歌主页上工作正常,但通知(每日更新)不适用于谷歌家用迷你设备 好每日更新在移动设备上工作得很好,我没有使用任何丰富的响应,如卡和迷你设备不支持的其他东西,那么可能的原因是什么? 目前它已部署home-notification-6b314相同的谷歌应用程序用于部署firebase功能(如webhook),dialogflow应用程序和谷歌上的操作

我该怎么办?

这是我在webhook上写的一些代码供参考:

// process.env.DEBUG = 'actions-on-google:*';
import * as functions from 'firebase-functions';
const { DialogflowApp } = require('actions-on-google');

const Actions = {
  UNRECOGNIZED_DEEP_LINK: 'deeplink.unknown',
  FINISH_UPDATE_SETUP: 'finish.update.setup',
};
const Parameters = {
  CATEGORY: 'category',
  UPDATE_INTENT: 'UPDATE_INTENT'
};

const DAILY_NOTIFICATION_ASKED = 'daily_notification_asked';
const PUSH_NOTIFICATION_ASKED = 'push_notification_asked';

export const webhook = functions.https.onRequest((request, response) => {
  try {
    const app = new DialogflowApp({ request, response });

    console.log('Request headers: ' + JSON.stringify(request.headers));
    console.log('Request body: ' + JSON.stringify(request.body));

    // Map of action from Dialogflow to handling function
    const actionMap = new Map();

    actionMap.set(app.StandardIntents.CONFIGURE_UPDATES, configureUpdates);
    actionMap.set(Actions.FINISH_UPDATE_SETUP, finishUpdateSetup);

    actionMap.set("welcome", welcome);
    actionMap.set("whatMissed", whatMissed);
    actionMap.set("what_did_i_missed.what_did_i_missed-yes", whatMissed_yes);

    app.handleRequest(actionMap);

  } catch (e) {
    console.log("catch error: ", e)
  }
});



function welcome(app) {

  app.ask(app.buildRichResponse()
    .addSimpleResponse({
      speech:
        `<speak>
            <s> Hi, I'm you medication assistant </s>
        </speak>`
    })
  )
}

// Start opt-in flow for daily updates
function configureUpdates(app) {
  console.log("====>> configure triggered1")

  const intent = app.getArgument('UPDATE_INTENT');
  console.log("#####  INTENT: ", intent);

  const category = app.getArgument('notification-category');
  console.log("#####  category: ", category);

  app.askToRegisterDailyUpdate(
    'what_did_i_missed',
    [{ name: "some name", textValue: "some text" }]
  );
}

// Confirm outcome of opt-in for daily updates.
function finishUpdateSetup(app) {
  console.log("====>> finish triggered")

  if (app.isUpdateRegistered()) {
    app.tell("Ok, I'll start giving you notification that time.");
  } else {
    app.tell("something went wrong when i was scheduling up notification");
  }
}



// # NOTE
// must have to enable notification 2 places, 
// - first in google action dashboard(overview>Action discovery and updates>{intent-name}>Enable User updates and notifications>set title of notification) 
// - second in google cloud console(Firebase Cloud Messaging API), 
// otherwise i will just keep saying '{your app name} is not responding'



function whatMissed(app) {

  const status = app.getArgument("boolean");
  if (status === 'yes') {
    app.tell("Ok, good job. keep it up!");
  } else {
    app.ask("would you like me to remind you again?");
  }

}

function whatMissed_yes(app) {

  app.askToRegisterDailyUpdate(
    'what_did_i_missed',
    [{ name: "some name", textValue: "some text" }]
  );
}

1 个答案:

答案 0 :(得分:4)

&#34;在第一次迭代中,更新是用户启用助理的手机上的系统通知,但我们计划扩展到新的表面。&#34; https://developers.google.com/actions/assistant/updates/overview

支持人员也表示只支持移动设备,而不支持google home和mini等其他界面。

相关问题