I'm working with dialogflow quick replies and i want to show the options to the user vertically. What i mean is, by default, the user will see the options side by side and they have to scroll horizontally to see the other options. The user sees something like this:
Option1 Option2 Option3 Option4.
However, i want to display it vertically:
Option1
Option2
Option3
Option4
I read the dialogflow documentation but i couldnt find anything useful. I also tried "\n" that doesnt work either. This is what i have currently
agent.add(new Suggestion("Option1"));
agent.add(new Suggestion("Option2"));
agent.add(new Suggestion("Option3"));
agent.add(new Suggestion("Option4"));
Normally suggestions are for Google Assistant and Fb Messenger.
No way you can do this in any of the supported platforms.
You have to manage this on your front end side i.e your custom implementation of Dialogflow chat widget.
Related
I'm using the Alexa Node SDK to build my application which is hosted on AWS Lambda. When using an Echo Show (or any display-enabled device), I'd like the screen to update with a full-screen image when Alexa responds with audio.
I'm able to do this with the "Standard Card" -- but the image is very small and appears to the right of the spoken text.
Is there any way to remove the text and display the image full screen?
Sample code:
return handlerInput.responseBuilder
.speak('my text')
.withStandardCard('my title', 'my text', 'https://myimage-sm.jpg', 'https://myimage-lg.jpg')
.reprompt('my title', 'my text')
.addElicitSlotDirective('slotname')
.getResponse();
To be clear, I've also tried adding a template with addRenderTemplateDirective, but this throws an error, as Alexa allows only one directive per slot.
No other directives are allowed to be specified with a Dialog directive. The following Dialog Directives were returned: [Display.RenderTemplate]
You can try my project here which uses APL behind the curtains to render the card wit a full background. BTW, the limitation is not one directive per slot, the limitation is that you can't use any dialog related directive with other directives, for example render template directives or APL directives. So if you're going to do dialog management forget about sending display rendering directives for the time being.
I added suggestedActions to chatbot. But it displays all options in Horizontal and it is not showing full texts.
Below the code
var msg = new builder.Message(session)
.text("What would you like assistance with?")
.suggestedActions(
builder.SuggestedActions.create(
session, [
builder.CardAction.imBack(session, "Texas Workforce Commission", "1. Texas Workforce Commission"),
builder.CardAction.imBack(session, "Jobs Y’all", "2. Jobs Y’all")
]
));
session.send(msg);
Attached the screenshot.
Output
Questions:
Right now the options are displaying horizontally. I need to display the options vertically. How do i do that?
And the first option in the list is truncated automatically. How should i display all options so they are not truncated?
No, there is no way to do this in your code. This is a problem of how the cards you send are rendered by each channels and i think for most of the channels there isn't a way neither.
But if you use WebChat then the answer could by yes. It depends on your React/JavaScript skills. WebChat is a React app which is compiled to javascript and bundled to one botchat.js. In this case you have two options:
Modify the React code which will produce a modified botchat.js
Modify the final botchat.js
I myself ended up modifying the react code and this is the only option i can recommend to you. It may take you some time but in the end it's worth it.
As you can see from the image below, putting two separate 'text response' buttons gives me a two line response.
However, I only get either one of the responses (at random) when I use the Web Demo integration. Either 'Hi, welcome!' or 'How may I help?'
Anyone got any ideas why? Thanks!
Not sure where my image link went... anyway read a few Google forums that said this isn't possible. Solved the problem by just pressing space until it went onto a new line.
When you are in Default responses tab, then it gives two options: Text response, custom payload
You should select Google assistant tab before clicking the add response button. Thus You can see all options about responses.
I am exploring api.ai now a days for one assignment to develop chat bot. Is there a way to add hyperlinks as a part of default response? I do not want to use Google Assistant, Facebook Messanger, KIK,Slack etc but I want to include hyperlink as a part of Default Response. I explored various blogs but could not find desired answer.
Practically you can't, but there is a hack:
Choose the response to be card.
Choose a custom image.
Embed link in the "next".
No, ideally you can not add a hyperlink in default response of api.ai but there is a workaround that I used in my code. In my case, I have developed my own chat window where before printing, I'm running a check on the response that is coming from api.ai using following function & get that link converted into the clickable format.
if(!String.linkify) {
String.prototype.linkify = function() {
// http://, https://, ftp://
var urlPattern = /\b(?:https?|ftp):\/\/[a-z0-9-+&##\/%?=~_|!:,.;]*[a-z0-9-+&##\/%=~_|]/gim;
// www. sans http:// or https://
var pseudoUrlPattern = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
// Email addresses
var emailAddressPattern = /[\w.]+#[a-zA-Z_-]+?(?:\.[a-zA-Z]{2,6})+/gim;
return this
.replace(urlPattern, '<a target="_blank" href="$&">$&</a>')
.replace(pseudoUrlPattern, '$1<a target="_blank" href="http://$2">$2</a>')
.replace(emailAddressPattern, '$&');
};
}
I'm writing a telegram bot but I have a question.
For now my bot will search for an image based on user request, but if I the bat found more than one image I want to send to the user a list of image with a link for search that iamge.
Eg.
/command mickey mouse
.... image 1....
I found more than one image, please be more specific
[link to image 2]
[link to image 3]
If the user will click the link I need to autosend message with the command and the name of the new image.
Is possible? I tried to add an hyperlink to the telegram api but i will open in the browser and send me a json with call status of the api.
For inline mode you can simply return a list of image results that will be displayed as kind of a popup on top of keyboard.
For conversation mode you have options:
1) Return images as inline keyboard attachment to a message with array of buttons each having callback_data parameter or switch_inline_query_current_chat or url parameter. Handle one of this to display the image.
2) Return message text as HTML with list of links in form of: image name
Then you can parse the start command and extract image ID. This has disadvantage that user would need to click the "START" button every time after he clicked the link.
You can use the 2nd approach with inline mode as well.
In my #DebtsTrackerBot I use both callbacks & switch_inline_query_current_chat for similar task.
We can vote the suggestion for TelegramBotApi: https://bugs.telegram.org/c/3901