Hello,
In Message Node for web/mobile client I am using advanced option and selected “Button template” in which I need buttons along with text and inside that text I need an inline text where I am using anchor tag
example:var info = [“Books”, “Pens”];
var message = {
“type”: “template”,
“payload”: {
“template_type”: “button”,
“text”: “What do you need? you can visit Webpage”,
“subText”: “Button Template Description”,
“buttons”: []
}
};
for (i = 0; i < info.length; i++) {
// if the button is to send back text to platform
var button = {
“type”: “postback”,
“title”: info[i],
“payload”: info[i]
};
message.payload.buttons.push(button);
}
print(JSON.stringify(message));
but I am getting output in test bot:
{“type”:“template”,“payload”:{“template_type”:“button”,“text”:“What do you need? you can visit Webpage”,“subText”:“Button Template Description”,“buttons”:[{“type”:“postback”,“title”:“Books”,“payload”:“Books”},{“type”:“postback”,“title”:“Pens”,“payload”:“Pens”}]}}
@k.tummalacharla
In one of the screenshots, you would notice there is a commented code for adding a button that can serve as an URL redirector.
refer to /*Uncomment this if the button is to redirect the url
Did you try using this? I hope that resolves your issue.
that uncomment section I use it when I need button with link but my requirement is Inline text ( word with link inside text) in button template along with buttons
text: “hello click here (this as inline text)”
buttons: [button1,button2] which needs to inside postback as I required these as utterances.
at the end of button template the print(JSON.stringify(message)) is also applying on anchor tag I am getting entire object as response not getting normal button template response.
The solution you provided is working fine in koreai test bot, My deployed channel is web/mobile client, it is not working in deployed chat bot page, can you please provide another solution for this.
We tested with local host and could confirm that the hyperlink works as expected. Let us know if you are using the latest SDK for testing. Also let us know the website you have integrated the bot with. Is it accessible for us to test?
I will confirm with my Lead, if I can share the website or not mean while can you please share you local host code where you are rending the bot message for the above issue.
I am facing a similar issue however, I am wanting the link to generate from the Knowledge base instead of a written in message. For example, the customer ask a specific question and the response should answer said question and direct them to a link for more information. Can someone assist?
This might be helpful and allows you to have both a clickable link in the message text and a separate button, giving users multiple ways to access the URL.
Please try and and let us know if that works for you ?