Reputation: 51
In sequence of my prior question about the WebhookResponse class I have a new one:
I tried another approach:
webhookResp = new WebhookResponse
{
FulfillmentText = @"TEXT",
FulfillmentMessages =
{
new Message
{
SimpleResponses = new Message.Types.SimpleResponses
{
SimpleResponses_ =
{
{ new Message.Types.SimpleResponse
{
DisplayText = ans.Phrase,
TextToSpeech = ans.Phrase,
Ssml = $"<speak>{ans.Phrase}</speak>"
}
}
}
},
BasicCard = new Message.Types.BasicCard
{
Title = Constants.help_title,
Subtitle = Constants.help_answer,
FormattedText = ans.Phrase,
Image = new Message.Types.Image
{
ImageUri = "https://example.com/images/example.png",
AccessibilityText = "Image Text"
},
Buttons =
{
new Message.Types.BasicCard.Types.Button
{
Title = @"Call",
OpenUriAction = new Message.Types.BasicCard.Types.Button.Types.OpenUriAction
{
Uri = "<your visit url>"
}
}
}
},
Platform = Message.Types.Platform.ActionsOnGoogle
}
},
Source = "my-webhook",
};
Json received by the Assistant:
{
"conversationToken": "[]",
"expectUserResponse": true,
"expectedInputs": [
{
"inputPrompt": {
"richInitialPrompt": {
"items": [
{
"basicCard": {
"title": "Help",
"subtitle": "I can connect you to the Cloogy team. Try calling them. ",
"formattedText": "I can connect you to the Cloogy team. Try calling them. ",
"image": {
"url": "https://example.com/images/example.png",
"accessibilityText": "Image Text"
},
"buttons": [
{
"title": "Call",
"openUrlAction": {
"url": "<your visit url>"
}
}
]
}
}
]
}
},
"possibleIntents": [
{
"intent": "assistant.intent.action.TEXT"
}
],
"speechBiasingHints": [
"$plug_state",
"$plug_id"
]
}
],
"responseMetadata": {
"status": {
"message": "Success (200)"
},
"queryMatchInfo": {
"queryMatched": true,
"intent": "749c5c8e-08ab-4474-b2aa-023143a119b3"
},
"delegatedRequest": {
"delegatedRequest": "{\n \"responseId\": \"e0744f37-7ad2-476a-938f-58434e8f362c-0820055c\",\n \"queryResult\": {\n \"queryText\": \"help\",\n \"parameters\": {\n },\n \"allRequiredParamsPresent\": true,\n \"outputContexts\": [{\n \"name\": \"projects/helper-fklyfp/agent/sessions/SESSION/contexts/actions_capability_audio_output\"\n }, {\n \"name\": \"projects/helper-fklyfp/agent/sessions/SESSION/contexts/actions_capability_media_response_audio\"\n }, {\n \"name\": \"projects/helper-fklyfp/agent/sessions/SESSION/contexts/actions_capability_account_linking\"\n }, {\n \"name\": \"projects/helper-fklyfp/agent/sessions/SESSION/contexts/actions_capability_screen_output\"\n }, {\n \"name\": \"projects/helper-fklyfp/agent/sessions/SESSION/contexts/actions_capability_web_browser\"\n }, {\n \"name\": \"projects/helper-fklyfp/agent/sessions/SESSION/contexts/google_assistant_input_type_keyboard\"\n }, {\n \"name\": \"projects/helper-fklyfp/agent/sessions/SESSION/contexts/__system_counters__\",\n \"parameters\": {\n \"no-input\": 0.0,\n \"no-match\": 0.0\n }\n }],\n \"intent\": {\n \"name\": \"projects/helper-fklyfp/agent/intents/749c5c8e-08ab-4474-b2aa-023143a119b3\",\n \"displayName\": \"ask help\"\n },\n \"intentDetectionConfidence\": 0.80672485,\n \"languageCode\": \"en\"\n },\n \"originalDetectIntentRequest\": {\n \"source\": \"google\",\n \"version\": \"2\",\n \"payload\": {\n \"user\": {\n \"accessToken\": \"ACCESS_TOKEN\",\n \"locale\": \"en-US\",\n \"lastSeen\": \"2020-07-29T15:10:16Z\",\n \"userVerificationStatus\": \"VERIFIED\"\n },\n \"conversation\": {\n \"conversationId\": \"SESSION\",\n \"type\": \"ACTIVE\",\n \"conversationToken\": \"[]\"\n },\n \"inputs\": [{\n \"intent\": \"actions.intent.TEXT\",\n \"rawInputs\": [{\n \"inputType\": \"KEYBOARD\",\n \"query\": \"help\"\n }],\n \"arguments\": [{\n \"name\": \"text\",\n \"rawText\": \"help\",\n \"textValue\": \"help\"\n }]\n }],\n \"surface\": {\n \"capabilities\": [{\n \"name\": \"actions.capability.AUDIO_OUTPUT\"\n }, {\n \"name\": \"actions.capability.MEDIA_RESPONSE_AUDIO\"\n }, {\n \"name\": \"actions.capability.ACCOUNT_LINKING\"\n }, {\n \"name\": \"actions.capability.SCREEN_OUTPUT\"\n }, {\n \"name\": \"actions.capability.WEB_BROWSER\"\n }]\n },\n \"isInSandbox\": true,\n \"availableSurfaces\": [{\n \"capabilities\": [{\n \"name\": \"actions.capability.SCREEN_OUTPUT\"\n }, {\n \"name\": \"actions.capability.WEB_BROWSER\"\n }, {\n \"name\": \"actions.capability.AUDIO_OUTPUT\"\n }]\n }],\n \"requestType\": \"SIMULATOR\"\n }\n },\n \"session\": \"projects/helper-fklyfp/agent/sessions/SESSION\"\n}"
},
"delegatedResponse": {
"delegatedResponse": "{\"fulfillmentText\":\"TEXT\",\"fulfillmentMessages\":[{\"messageCase\":8,\"text\":null,\"image\":null,\"quickReplies\":null,\"card\":null,\"payload\":null,\"simpleResponses\":null,\"basicCard\":{\"title\":\"Help\",\"subtitle\":\"I can connect you to the Cloogy team. Try calling them. \",\"formattedText\":\"I can connect you to the Cloogy team. Try calling them. \",\"image\":{\"imageUri\":\"https://example.com/images/example.png\",\"accessibilityText\":\"Image Text\"},\"buttons\":[{\"title\":\"Call\",\"openUriAction\":{\"uri\":\"\\u003Cyour visit url\\u003E\"}}]},\"suggestions\":null,\"linkOutSuggestion\":null,\"listSelect\":null,\"carouselSelect\":null,\"browseCarouselCard\":null,\"tableCard\":null,\"mediaContent\":null,\"platform\":8}],\"source\":\"my-webhook\",\"payload\":null,\"outputContexts\":[],\"followupEventInput\":null,\"sessionEntityTypes\":[]}"
}
}
}
I guess there's something wrong with de delegatedResponse field, but I don't know how to fix it, beacause I don't explicitly fill it in. (or at least I think I don't). Why is the output given by GoogleActions not a BasicCard?
Thanks for any help in advance,
páris
Upvotes: 0
Views: 41
Reputation: 50701
That error is a broad message meaning it couldn't translate the response from your webhook into a valid response to Actions on Google. In this case, it actually looks like there was no SimpleResponse
sent back, even tho it looks like you tried to specify one.
The WebhookResponse
object really isn't intended for this purpose, and I'm not sure how it is serializing into JSON for the response.
Upvotes: 1