0

The Bot can only display the Text but not the Hint after updated Syn.Bot from version 2.9 to to 4.6. Tried to add Dialog or import an Oryzer workplace have the same result... I am a beginner in Syn Bot, can someone give me a hand? Thanks.

using System;
using System.Web;
using System.Web.UI;
using Syn.Bot.Channels.Widget;
using Syn.Bot.Oscova;
using Syn.Bot.Oscova.Attributes;

namespace BotWebsite
{
    public partial class BotService : Page
    {
        private static WidgetChannel WidgetChannel { get; }
        private static OscovaBot bot { get; }
        static BotService()
        {
            bot = new OscovaBot();
            //bot.ImportWorkspace("");
            WidgetChannel = new WidgetChannel(bot);
            bot.Dialogs.Add(new AppDialog());
            bot.Dialogs.Add(new ProductDialog());

            bot.Trainer.StartTraining();

            var websiteUrl = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority);
            WidgetChannel.ServiceUrl = websiteUrl + "/BotService.aspx";
            WidgetChannel.ResourceUrl = websiteUrl + "/BotResources";
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            WidgetChannel.Process(Request, Response);
        }
    }

    public class ProductDialog: Dialog
    {
        [Expression("test")]
        public void test(Result result)
        {
            var response = new Response();
            response.Text = "I was expecting a yes or no answer.";
            response.Hint = "Yes|No";
            result.SendResponse(response);
        }
    }

}

1 Answers1

0

Although a bit late to the party here. This might help someone in the future. You could achieve what you've asked for by replacing the body of the test method to the following.

var response = new Response();

response.Messages.Add(
    new QuickReplyMessage
    {
        Title = "I was expecting a yes or no answer.",
        Replies = new List<string>
        {
            "Yes",
            "No",
        }
    });

result.SendResponse(response);
Nathan
  • 1,303
  • 12
  • 26