Having read a few different entries on here and Stackoverflow, I am trying to format some of the Watson Assistant outputs with HTML markup to add hyperlinks, emails, bold characters etc... An example is below:-
Please click on this link to the <a target="_blank" href="https://myurl.com”>video </a>.\n<br/><br/>. The password is <b>openthevideo</b>.
Here's my json output:-
{
"output": {
"generic": [
{
"time": 2000,
"typing": true,
"response_type": "pause"
},
{
"values": [
{
"text": "Please click on this link to the <a target=\"_blank\" href=\"https://myurl.com”>video </a>.\\n<br/><br/>. The password is <b>openthevideo</b>\n"
}
],
"response_type": "text",
"selection_policy": "sequential"
}
]
}
}
Nonetheless, it returns the HTML source code when testing
Any suggestions on what I'm doing wrong?
Thanks
Answer by MitchMason (5245) | Nov 12, 2018 at 02:59 PM
The preview link will have HTML support added in the near future. Its really meant for quick and dirty basic testing. As stated above, once on the iOS device whatever application is displaying the responses will have to have HTML support, which is fairly common nowadays so shouldn't be too much trouble.
you'll notice it should work in the tryout panel for testing, preview link will soon follow.
Thanks @MitchMason . Indeed it does work in the tryout panel
Answer by @chughts (11657) | Nov 12, 2018 at 02:34 PM
This is not a Watson Assistant specific question. Clearly Watson Assistant is outputting the markup correctly. The question actually relates to your client side code and how it is injecting the text output onto your test page. That is the code and html that you need to share to allow us to debug it for you.
It looks like you are setting the text of something like a multiline text box. Whereas what you want to be doing is inserting into something like a styled <div>
or <span>
Many thanks for the response.
I am using the 'Preview link' option in the new integration functionality of Assistant. The actual end client running the chatbot will be an iOS device though.