将推式通知标题发送给其在Google Actions中的调用意图

时间:2018-10-09 06:10:49

标签: push-notification actions-on-google dialogflow

我正在Google的“操作”中发送推送通知(参考this official documentation)。

因此,一旦我发送了通知,我就会在其中发送title。看起来像这样,A Very Happy Birthday, Jay Patel是我发送的标题。

enter image description here

因此,一旦我单击通知,它就会打开Goog​​le助手并调用意图(已配置in this step),但是它没有指定与该通知有关的任何上下文或其他数据,因此我不会找人我在title中指定的名称或其他任何数据。

  

我想知道,无论如何,当出现以下情况时,我可以将一些数据(标题或通知的任何其他数据)传递给调用意图   有人点击通知?

有人点击通知时,我在Webhook中收到了json响应

    {  
   "responseId":"e2de9045-b415-kr45-be96-1a35779abcde",
   "queryResult":{  
      "queryText":"intent:send_push",
      "parameters":{  

      },
      "allRequiredParamsPresent":true,
      "fulfillmentText":"Latest update is here!",
      "fulfillmentMessages":[  
         {  
            "text":{  
               "text":[  
                  "Latest update is here!"
               ]
            }
         }
      ],
      "intent":{  
         "name":"projects/happierwork-bot/agent/intents/d1f4c032-28cf-4906-a393-6f2a612c0496",
         "displayName":"send_push"
      },
      "intentDetectionConfidence":1.0,
      "languageCode":"en-in"
   },
   "originalDetectIntentRequest":{  
      "source":"google",
      "version":"2",
      "payload":{  
         "user":{  
            "userId":"my_id",
            "accessToken":"my_token",
            "permissions":[  
               "UPDATE"
            ],
            "locale":"en-IN",
            "lastSeen":"2018-10-09T05:57:18Z"
         },
         "conversation":{  
            "conversationId":"ABwppHE7XKXDdjfjSRPF_OCVttGKMavfasdffngesQEI2Jy11Q8fp8lNXgpgGtFe7KCxK3WWey-1ColL7",
            "type":"NEW"
         },
         "inputs":[  
            {  
               "intent":"send_push",
               "rawInputs":[  
                  {  
                     "inputType":"URL",
                     "url":"bot_url?intent=send_push"
                  }
               ],
               "arguments":[  
                  {  
                     "name":"UPDATES",
                     "boolValue":true
                  }
               ]
            }
         ],
         "surface":{  
            "capabilities":[  
               {  
                  "name":"actions.capability.WEB_BROWSER"
               },
               {  
                  "name":"actions.capability.AUDIO_OUTPUT"
               },
               {  
                  "name":"actions.capability.SCREEN_OUTPUT"
               },
               {  
                  "name":"actions.capability.MEDIA_RESPONSE_AUDIO"
               }
            ]
         },
         "isInSandbox":true,
         "availableSurfaces":[  
            {  
               "capabilities":[  
                  {  
                     "name":"actions.capability.WEB_BROWSER"
                  },
                  {  
                     "name":"actions.capability.AUDIO_OUTPUT"
                  },
                  {  
                     "name":"actions.capability.SCREEN_OUTPUT"
                  }
               ]
            }
         ]
      }
   },
   "session":"projects/myproject-bot/agent/sessions/ABwppHE7XKXDdjfjSRPF_OCVtasdffagbKiGKA9sCsQEI2Jy11Q8fp8lNXgpgGtFe7KCxK3WWey-1ColL7"
}

1 个答案:

答案 0 :(得分:0)

您可以使用推送消息目标的参数字段来提供参数数据。

请查看参考以获取更多详细信息: https://actions-on-google.github.io/actions-on-google-nodejs/2.12.0/interfaces/_service_actionssdk_api_v2_.googleactionsv2custompushmessagetarget.html