How to display Tables in HTML


(Sudipta Bhawmik) #1

I am trying to generate a report link in a Message, from a JSON that contains an array . The JSON is generated by a REST API from a Service node. The JSON is of the form:

“body”: {
“results”:[
{
“columns”: [ “A”,“B”],
“data”: [
{
“row”: [“X”,"Y],

My questions are:

  1. How do I specify the array elements for each column? Do I need to write a loop for each column and unroll the data? I tried to display only 1 row but it didn’t work.

  2. How to I specify the link in the Message Bot response? No clear instruction is available anywhere in the documents.

Any help is appreciated.

Thanks


(Swagat) #2

@bhawmik
Did you try using use https://developer.kore.ai/docs/bots/sdks/message-templates/#Mini_Table_Template
Or https://developer.kore.ai/docs/bots/sdks/message-templates/#Regular_Table_Template
Both the above would work for dialog task. We recommend not to print too heavy a table for better user experience.

Or you can also use information task’s bot-response.

  1. First save the sample response (Under API Request).
  2. Bot Response > Edit Template:
    image
  3. Print the link to table in message definition JS
    image