chat render suggested actions onPost event

1 Answer 45 Views
Chat
jerome
Top achievements
Rank 1
Iron
Iron
jerome asked on 18 Sep 2023, 02:22 PM

I can get the render suggested actions to work when its loaded up, but when the user selects an option, i want to render more suggested options for them to select.  I have the onpost firing. What am i missing here. this code fires but i dont see the options appear in the chat window.

 

function onPost(e) {

    if (e.sender.options.user.name != 'Bot') {

        if (e.text == 'How do I..?') {
            var chat = $("#chat").data("kendoChat");
            chat.renderSuggestedActions([{
                title: "Option 1.",
                value: "Option 1."
            }, {
                title: "Option 2",
                value: "Option 2"
            }
          
            ]);
        }

1 Answer, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 21 Sep 2023, 09:36 AM

Hi Jerome,

If you would like to suggest more options upon clicking on one, you will have to use the OnActionClick event. This event is triggered when the option is clicked, and so, in the event handler, you can have a condition checking for the selected option, and based on that, you can suggest more options or just reply with a message.

Regards,
Attila Antal
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
jerome
Top achievements
Rank 1
Iron
Iron
commented on 28 Sep 2023, 01:54 AM

I'm creating the chat object and setting it up all in javascript.  im using the function in the example in the link you posted, but i think im missing something on the bind. Do you have an example of this all in JS?

   chat.bind("onActionClick", onActionClick);

Attila Antal
Telerik team
commented on 02 Oct 2023, 02:56 PM

Jerome,

Telerik Web UI RadChat is an ASP.NET WebForms wrapper of the Kendo UI chat and can only be created in the Markup or CodeBehind.

In case you're creating the Chat Object using JavaScript, you likely using the Kendo UI Chat APIs. For instructions, please visit the Kendo UI APIs and Documentation:

For the WebForms RadChat component, attaching the click event can be done using the approach from the article I shared earlier, see OnActionClick

Tags
Chat
Asked by
jerome
Top achievements
Rank 1
Iron
Iron
Answers by
Attila Antal
Telerik team
Share this question
or