少し前から Actions on Google アプリに対して、8 分前後の間隔でヘルスチェック目的のクロールが行われるようになったようで、Dialogflow の History を見ると、GOOGLE_ASSISTANT_WELCOME の呼び出しが定期的に発生していることが確認できる。
Default Welcome Intent で Fulfillment を使っていなければ実害はないが、Webhook 呼び出しを行っている場合、この定期的なヘルスチェックで Webhook 側のリソースが消費されることになってしまう。
このヘルスチェックに対してコストをかけて処理するのは馬鹿らしいので、Webhook 側ではヘルスチェックによるリクエストかを判断して、ヘルスチェックに対しては可能な限りコストをかけずにレスポンスを返して処理を終わらせるのが良いかと思われる。
2019/8/1 現在、Webhook に渡される Json は以下のようになっている。「Crawler」とか「is_health_check」が判定に使えそうな感じ。
{
"responseId": "xxxxx",
"queryResult": {
"queryText": "GOOGLE_ASSISTANT_WELCOME",
"action": "input.welcome",
"parameters": {
},
"allRequiredParamsPresent": true,
"fulfillmentText": "知りたい仮想通貨を教えて下さい。",
"fulfillmentMessages": [{
"platform": "ACTIONS_ON_GOOGLE",
"simpleResponses": {
"simpleResponses": [{
"textToSpeech": "知りたい仮想通貨を教えて下さい。"
}]
}
}, {
"platform": "ACTIONS_ON_GOOGLE",
"suggestions": {
"suggestions": [{
"title": "BTC"
}, {
"title": "ETH"
}, {
"title": "LTC"
}, {
"title": "BCH"
}, {
"title": "XRP"
}]
}
}, {
"text": {
"text": ["知りたい仮想通貨を教えて下さい。"]
}
}],
"outputContexts": [{
"name": "projects/xxxxx/agent/environments/__aog-4/users/-/sessions/xxxxx/contexts/actions_capability_audio_output"
}, {
"name": "projects/xxxxx/agent/environments/__aog-4/users/-/sessions/xxxxx/contexts/google_assistant_input_type_voice"
}, {
"name": "projects/xxxxx/agent/environments/__aog-4/users/-/sessions/xxxxx/contexts/google_assistant_welcome"
}],
"intent": {
"name": "projects/xxxxx/agent/intents/xxxxx",
"displayName": "Default Welcome Intent"
},
"intentDetectionConfidence": 1.0,
"languageCode": "ja"
},
"originalDetectIntentRequest": {
"source": "google",
"version": "2",
"payload": {
"user": {
"userId": "xxxxx",
"profile": {
"givenName": "Google",
"familyName": "Crawler"
},
"locale": "ja-JP"
},
"conversation": {
"conversationId": "xxxxx",
"type": "NEW"
},
"inputs": [{
"intent": "actions.intent.MAIN",
"rawInputs": [{
"inputType": "VOICE",
"query": "仮想通貨チェック"
}],
"arguments": [{
"name": "is_health_check",
"boolValue": true,
"textValue": "1"
}]
}],
"surface": {
"capabilities": [{
"name": "actions.capability.AUDIO_OUTPUT"
}]
}
}
},
"session": "projects/xxxxx/agent/environments/__aog-4/users/-/sessions/xxxxx"
}
参考