如果使用者取消連結 smart home 動作與 Google Assistant,您的執行服務會收到 action.devices.DISCONNECT
意圖。這個意圖表示 Assistant 不會再為此使用者傳送任何意圖,您的雲端服務應停止為其裝置呼叫 Google Home Graph API (Request Sync 和 Report State)。
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "inputs": [{ "intent": "action.devices.DISCONNECT", }] }
JSON
{}
Node.js
const {smarthome} = require('actions-on-google'); const app = smarthome(); // ... app.onDisconnect((body, headers) => { // TODO Disconnect user account from Google Assistant // You can return an empty body return {}; });
Java
@Override public void onDisconnect( @NotNull DisconnectRequest disconnectRequest, @Nullable Map<?, ?> map) { // TODO Disconnect user account from Google Assistant // This function does not return anything }
詳情請參閱 DISCONNECT
意圖參考說明文件。