Why does the button not work in Google Assistant? - node.js

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.

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/',
}),

Related

Dialogflow Webhook Fulfillment not showing in Google Assistant Simulator

I'm trying to use Fulfillment with a Webhook to return a JSON to Dialogflow that will show a card in Google Assistant. I got the JSON directly from here:
https://developers.google.com/actions/conversation-api-playground
However, the card is not showing in the Google Assistant Simulator.
The simulator has a tab called "Response" and I can see the json response.
No errors in the error tab.
Have you added a subTitle to the basic card? That might be the issue here.
conv.ask(new BasicCard({
text: 'This is the Text',
title: 'Title',
subtitle: "This is a subtitle",
buttons: new Button({
title: 'Read More',
url: 'https://assistant.google.com/',
}),
image: new Image({
url: 'https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png',
alt: 'Image alternate text',
}),
}));
Please make these changes and try again.

SuiteScript 2.0 Two actions on submit button

I need add two action into submit button, I succeed on that but because I can't find correct function from API, there is two buttons. Like this
I want it like this:
What I have tried
form.addSubmitButton({ label: 'Action 1'});
form.addSubmitButton({ label: 'Action 2'});
And
form.addSubmitButton({ id : 'action', label: 'Action 1'});
form.addSubmitButton({ id : 'action', label: 'Action 2'});
And
form.addSubmitButton({ id: 'action1', label: 'Action 1'});
var test = form.addSubmitButton({ id: 'action2', label: 'Action 2'});
test.isHidden = true;
Something that worked for me was adding the name attribute to each submit button using client script. That way when the user clicks it will send the name as a parameter.

create links to bot_commands and pass parameters

When using the telegram API (in my case using telebot:https://github.com/kosmodrey/telebot)
How can link to a bot_command with a parameter ?
For example i want a bot that shows information about some fruits and i have
['apples','pears','bananas']
i can do /show [fruit] to show details about each fruit and /list to
show a list of all fruits.
When i do /list i want to show it like this:
You currently have 3 fruit:
APPLES PEARS BANANAS
However i want these to be clickable and once the user clicks a fruitname, he
will be directed to /show [clicked fruit].
i tried with a normal a href in { parse_mode : HTML } but that doesn't
seem to work.
Use inline buttons. They work the way you described. For example:
var options = {
reply_markup: JSON.stringify({
inline_keyboard: [
[
{text: 'button 1', callback_data: '1'},
{text: 'button 2', callback_data: '2'},
{text: 'button 3', callback_data: '3'},
],
]
})
};
bot.sendMessage(chatId, 'Pick action:', options);
You can think of them as anchor tags. They appear along with the text in chat window, and scroll with the text, but you can click on them. Non-inline buttons are more like a permanent menu.
Example above is using this library.

Adding a colorbutton in tinymce dialog with api 4.x doesn't work

I'm trying to add a colorbutton in a TinyMCE dialog box to replace my old color selector which was initially created with a select input.
See : ColorButton : API 4.X
This class creates a color button control. This is a split button in which the main button has a visual representation of the currently selected color. When clicked the caret button displays a color picker, allowing the user to select a new color.
I can add and see the new colorbutton in the dialog box but it doesn't show the colorpicker when clicked.
Here is my code:
editor.windowManager.open( {
title: 'Choose color',
body: [
{
type: 'listbox',
name: 'bg-color',
label: 'Color (select)',
'values': [
{text: 'White', value: '#FFF'},
{text: 'Black', value: '#000'},
{text: 'Silver', value: 'silver'},
]
},
{
type: 'ColorButton',
name: 'bg-color2',
label: 'Color (colorpicker)',
},
],
onsubmit: function(e) {
// Do something here
}
});
And you will find a tinymce fiddle here to illustrate this issue:http://fiddle.tinymce.com/sfeaab
Since my debugger doesn't show any JS error, is there something wrong in this code or is there another way to add a colorpicker in a dialogbox?
Thanks!
#MavBzh I think you've a wrong perception on how the color button works. The ColorButton UI is only help with rendering a button which not much difference with PanelButton UI. you can see this example http://fiddle.tinymce.com/sfeaab/3 in this fiddle I use textcolor plugin example.
So, in order to use color button you're required to specify the Panel to hold the color picker.
{
type: 'colorbutton',
name: 'color',
text: 'Color',
selectcmd: 'ForeColor',
panel: {
role: 'application',
ariaRemember: true,
html: renderColorPicker,
onclick: onPanelClick
},
onclick: onButtonClick
}
then later set onclick callback action and render the color picker HTML output yourself, the renderColorPicker function is used as the panel content, then assigned onPanelClick callback to put the color to the text placeholder in the ColorButton.
PS: in the fiddle I used v4.0.21

How do you prevent a jquery.qtip2 tooltip from hiding when the mouse is over the tip?

Using jquery qTip2 for tooltips.
I have a tooltip with a link in it. I want the tip to stay open if the user's mouse enters the tip (not the trigger). Can't seem to figure out how to do that in the documentation....
If you want it to remain visible when you mouse over and into the tip, but still want it to dismiss on mouseout, use the fixed and delay options as described in the documentation here:
$('.selector').qtip({
content: {
text: 'I hide on mouseout, but you can mouse into me within 500ms',
},
hide: {
fixed: true,
delay: 500
}
});
The hide parameter has many options. For example, if you just want to not hide it indefinitely, simply set hide to false:
$('.selector').qtip({
content: {
text: 'I never hide',
},
hide: false
});
If you want it to hide on a different event, such as clicking anywhere outside the tip, set the event explicitly:
$('.selector').qtip({
content: {
text: 'I hide when you click anywhere else on the document',
},
hide: {
event: 'unfocus'
}
});
If you want it to hide when the trigger is clicked, specify the click event:
$('.selector').qtip({
content: {
text: 'I hide when you click the tooltip trigger',
},
hide: {
event: 'click'
}
});
See specifically the "hide" options documentation for more info.
If you want the tip to stay open and then hide it when the user clicks outside the target or leaves the target:
show: {
event: 'mouseover'
},
hide: {
event: 'click mouseleave'
}

Resources