How to display list of choices by default when the chat starts?

I have created an dialogue task “Intent not identified” and used the function getChoices() to list all the tasks available to the user using button template. I have refereed the post to customize the message.

code on my message node
image

But I am getting an error while running this dialogue task as " Uncaught ReferenceError: getChoices is not defined at 2:12", kindly advice.

Also how to make this dialogue task to run by default when the chat starts, to list down what all tasks this bot can perform, without any user input?

Regards
Sushmita

@sushmita.nandi

getChoices is predominantly used for standard responses. You may not use it for dialog tasks. It is context based and if you invoke it without the right context, the function will not be available.

If you need to run a task onConnenct please configure the same event and map the task. The task will not be able to pick up details of available tasks and you will need to use a hard coded button template (or any other template).

@Subrahmanyam @karthik.tadikonda please add your thoughts.

@swagata.sengupta Can you explain the 2nd part a little more?

@sushmita.nandi
As per my understanding, you want to run a task with onConnect which will enable the user to click on the options and invoke all possible tasks in the bot.
You can use onConnect even to call a task.
There you should have a message node with channel (if you need Web channel integration) specific template (like button template for our web channel) to enlist all the things bot can do. The payload for all options should be a trained utterance for other tasks you want to invoke when you click on the button.
Hope this is more clear now.

Yes clear, I am able to list down all the task with onConnect event with button template. But clicking on the options in the chat bot is initiating the task, as oppose to I want to print a hint message for that task mainly a hint question that user can try to initiate the task.

@sushmita.nandi
Is this a real business use case? Or just for exploring the functionality? We do not see use cases like this normally. Usually users want the bot to do something for them when the click somewhere or select some option.
If this is a real-time use case please share the same here. You can hide confidential details.

yes, it is real time use case. When user clicks any task, I want to display a text which says what kind of answer user may expect from this task and display a sample question. So, when the user types the actual question then the task should invoke.

Regards
Sushmita

@sushmita.nandi

There is no direct way to achieve this. What you can still do it use bot kit. Tap, on_user_message. If you use some very specific payloads (post back) for your message template (like - TASK_CODE_001), bot kit will receive the same. You can tap it in on user message event, and write a logic to send back a response without forwarding the payload to the chat script engine.

You can find some details here.
https://developer.kore.ai/docs/bots/sdks/functions-for-the-botkit-sdk/
Also, You can find some examples like book a cab, find a flight in https://github.com/Koredotcom/BotKit