将推式通知标题发送给其在Google Actions中的调用意图 [英] Send push notification title to its invocation intent in Actions on Google

查看:89
本文介绍了将推式通知标题发送给其在Google Actions中的调用意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Google的操作中发送推送通知(请参阅



因此,一旦我单击通知,它就会打开Goog​​le助手并调用意图(已配置在此步骤),但它没有指定与此相关的任何上下文或其他数据通知,这样我就不会得到在标题中指定的人名或任何其他数据。


我想知道,是否有这样的东西,以便当
人点击通知时,我可以将一些数据(标题或通知的任何其他数据)传递给调用意图?


我得到了这个json resp当有人点击通知时,在我的网络钩子上就出现了

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

},
allRequiredParamsPresent:true,
fulfillmentText:最新更新在这里!,
fulfillmentMessages:[
{
text:{
文本:[
最新更新在这里!
]
}
}
],
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,
权限:[
UPDATE
],
locale: en-IN,
lastSeen: 2018-10-09T05:57:18Z
},
conversation: {
conversationId: ABwppHE7XKXDdjfjSRPF_OCVttGKMavfasdffngesQEI2Jy11Q8fp8lNXgpgGtFe7KCxK3WWey-1ColL7,
type: NEW
},
{ $ b intent: send_push,
rawInputs:[
{
inputType: URL,
url: bot_url?intent = send_push
}
],
参数:[
{
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
}
解决方案

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



请查看参考资料详细信息:
https://actions-on-google.github.io/actions-on -google-nodejs / 2.12.0 / interfaces / _service_actionssdk_api_v2_.googleactionsv2custompushmessagetarget.html


I'm sending push notifications in Actions on Google (ref this official documentation).

So once I send the notification I'm sending title in it. So it looks like this, where A Very Happy Birthday, Jay Patel is the title that I've sent.

So once I click on the notification, it opens Google Assistant and invokes the intent (configured in this step), but it doesn't specify any contexts or other data regarding that notification so I'm not getting a person name that I've specified in title or any other data.

I want to know, is there anyway so that I can pass some data(title or any other data of notification) to the invocation intent when a person taps on the notification?

I'm getting this json response in my webhook when a person taps on the notification

    {  
   "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"
}

解决方案

You can supply argument data using the argument field of the push message target.

Please view the reference for more detail: https://actions-on-google.github.io/actions-on-google-nodejs/2.12.0/interfaces/_service_actionssdk_api_v2_.googleactionsv2custompushmessagetarget.html

这篇关于将推式通知标题发送给其在Google Actions中的调用意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆