I'm trying to create a card to use in a Google Chat message.
I've pasted the JSON example from the Google Chat reference in the Card Builder , but on running it in the builder, I get an `Unknown field in Card JSON` error.
What could be the cause?
Solved! Go to Solution.
if you put only code inside "card" it work.
Try this
{
"header": {
"title": "Sasha",
"subtitle": "Software Engineer",
"imageUrl":
"https://developers.google.com/chat/images/quickstart-app-avatar.png",
"imageType": "CIRCLE",
"imageAltText": "Avatar for Sasha",
},
"sections": [
{
"header": "Contact Info",
"collapsible": true,
"uncollapsibleWidgetsCount": 1,
"widgets": [
{
"decoratedText": {
"startIcon": {
"knownIcon": "EMAIL"
},
"text": "sasha@example.com"
}
},
{
"decoratedText": {
"startIcon": {
"knownIcon": "PERSON"
},
"text": "<font color=\"#80e27e\">Online</font>"
}
},
{
"decoratedText": {
"startIcon": {
"knownIcon": "PHONE"
},
"text": "+1 (555) 555-1234"
}
},
{
"buttonList": {
"buttons": [
{
"text": "Share",
"onClick": {
"openLink": {
"url": "https://example.com/share"
}
}
},
{
"text": "Edit",
"onClick": {
"action": {
"function": "goToView",
"parameters": [
{
"key": "viewType",
"value": "EDIT"
}
]
}
}
}
]
}
}
]
}
]
}
can you please post the response you are sending to Google chat?
I started pasting the code example in Dialogflow console as a Custom Payload, but that gave me a lot of 'unexpected comma' errors. So I figured I'd try pasting it in Card Builder, but then I got the errors 'Unknown field' errors.
if you put only code inside "card" it work.
Try this
{
"header": {
"title": "Sasha",
"subtitle": "Software Engineer",
"imageUrl":
"https://developers.google.com/chat/images/quickstart-app-avatar.png",
"imageType": "CIRCLE",
"imageAltText": "Avatar for Sasha",
},
"sections": [
{
"header": "Contact Info",
"collapsible": true,
"uncollapsibleWidgetsCount": 1,
"widgets": [
{
"decoratedText": {
"startIcon": {
"knownIcon": "EMAIL"
},
"text": "sasha@example.com"
}
},
{
"decoratedText": {
"startIcon": {
"knownIcon": "PERSON"
},
"text": "<font color=\"#80e27e\">Online</font>"
}
},
{
"decoratedText": {
"startIcon": {
"knownIcon": "PHONE"
},
"text": "+1 (555) 555-1234"
}
},
{
"buttonList": {
"buttons": [
{
"text": "Share",
"onClick": {
"openLink": {
"url": "https://example.com/share"
}
}
},
{
"text": "Edit",
"onClick": {
"action": {
"function": "goToView",
"parameters": [
{
"key": "viewType",
"value": "EDIT"
}
]
}
}
}
]
}
}
]
}
]
}
Thanks @calle , no errors now.
Follow up question: for the Default Welcome intent I now have a text response, and use the code above for the Google Assistant integration (2nd tab under Responses) as a custom payload – see screenshot.
However, interacting through Google Chat still gets me the plain text version. How can I solve this?
hi! I think you have to test this in a real chat
I am! But when interacting through Google Chat I get the default text version, not the channel specific one.
I’m going to check that, thanks!
@xavidop & @calle thanks for jumping in to help out! @richardk1 keep us posted on if things work out for you.
Cheers,
Roderick
It wasn't a channel ID problem in the end but a mistake in the configuration (I confused Google Assistant with Google Chat).
Still have problems with delivering the custom payload but I'll post that seperately to not make this more convoluted than it already is 🙂
sounds good!
Remember to close the threads with a solution too! just replied to the other thread
Already marked at as Solved. Do I need to do anything else?
Hi, I have integrated the card with google chat to know the quality of the response given my bot, I want to know how to update the card once anyone has interacted with it.
you have to add an event to that card: https://medium.com/@AntonShevchuk/google-chat-bot-interaction-and-card-updates-e2d5dc995f78
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |