codingPerson
codingPerson

Reputation: 109

Why does the button not work in Google Assistant?

I attempt to add a button onto my action on Google assistant, but the code only works for the first one. Here is where I add in the button for the ones that don't work:

'Biology': {
title: 'Biology',
text:'Press the button to visit our site for more info. Biology is an important subject for those who are willing to take it, and this website will provide you' +
'with the necessary skill for this subject.',
image: new Image({
  url: 'https://www.edzuki.com/biology/Biology+Edzuki.jpg',
  alt: 'Biology as a subject',
}),
button: new Button({
  title:'Click for the Biology Page',
  url: 'https://www.edzuki.com/biology/',
}),

and, for some reason, this one works

'Art': {
title: 'Art',
text:'Press the button to visit our site for more info. Art is an important subject for those who are willing to take it, and this website will provide you' +
'with the necessary skill for this subject.',
image: new Image({
  url: 'https://www.edzuki.com/art/Art.jpg',
  alt: 'Art as a subject',
}),
buttons: new Button({
title: 'Click for Art',
url: `https://www.edzuki.com/art/`,
}),
display: 'WHITE',
},

for const subjectCard (a basic card). No errors are thrown by the assistant, just no button is visible. Why is this? Thanks in advance.

Upvotes: 0

Views: 56

Answers (1)

TommyBs
TommyBs

Reputation: 9646

In your first example you use the key button for your button, but in the second example you use buttons with an 's'. The docs also suggest you should be using the plural version buttons and your own code should show you this works based on your second working example

https://developers.google.com/actions/assistant/responses#basic_card

e.g

'Biology': {
title: 'Biology',
text:'Press the button to visit our site for more info. Biology is an important subject for those who are willing to take it, and this website will provide you' +
'with the necessary skill for this subject.',
image: new Image({
  url: 'https://www.edzuki.com/biology/Biology+Edzuki.jpg',
  alt: 'Biology as a subject',
}),
buttons: new Button({
  title:'Click for the Biology Page',
  url: 'https://www.edzuki.com/biology/',
}),

Upvotes: 1

Related Questions