Proactive Bot not working with Framework version 3.9.0

56 Views Asked by At

I created a LUIS root dialog that creates dialogs depending on the intent. I found a sample code to do Proactive Bot Messages but it doesn't seem to work with v3.9.0 of the framework.

I added a Conversation Starter class:

public class ConversationStarter
{    
  public static string ResumptionCookie;

  SurveyDialog, then wait until that's done 
  public static async Task Resume()
  {
    var message = Microsoft.Bot.Builder.Dialogs.ResumptionCookie.GZipDeserialize(ResumptionCookie).GetMessage();        

    using (var scope = DialogModule.BeginLifetimeScope(Conversation.Container, message))
    {
      var botData = scope.Resolve<IBotData>();
      await botData.LoadAsync(CancellationToken.None);
      var stack = scope.Resolve<IDialogStack>();
      var dialog = new CreateTradeAfterInterrupt();
      stack.Call(dialog.Void<object, IMessageActivity>(), null);
      await stack.Poll(CancellationToken.None);
      await botData.FlushAsync(CancellationToken.None);    
    }
  }
}

The "stack.Poll" method was removed. Is there an equivalent for this new version of the Framework? If I comment this line out, the interruption doesn't happen at all.

I set the Resumption Cookie at the MessageController level:

public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
  if (activity.Type == ActivityTypes.Message)
  {
    ConversationStarter.ResumptionCookie = new ResumptionCookie(activity).GZipSerialize();          
    await Conversation.SendAsync(activity, MakeLuisDialog);
  }
  else
  {
    HandleSystemMessage(activity);
  }
  var response = Request.CreateResponse(HttpStatusCode.OK);
  return response;
}

I have another controller that I use to post events to and execute:

await ConversationStarter.Resume();

The CreateTrade dialog is a simple dialog that calls PromptDialog.Choice and offers the user the option to buy/sell stocks etc.

Any idea why this isn't working?

0

There are 0 best solutions below