0

Using MS Bot Framework and Facebook messenger as channel.

I have a short form that asks about Rarity(from an int list) and Variation(from an enum with two choices).

It works fine in Web Chat and Emulator but on messenger, it shows no buttons and no possible answers when you type help.

This is my code:

[Serializable]
public class RarityAndLevelForm
{
    [Prompt("What is the {&} of your hero? {||}")]
    public int? Rarity;
    [Prompt("Chose {&} of your hero? {||}")]
    public StatsVariation StatsVariation;

    public static IForm<RarityAndLevelForm> BuildForm()
    {
        return new FormBuilder<RarityAndLevelForm>()
            .Message("Answer the questions to get your hero's IVs. Type help for additional information or quit to cancel.")
            .Field(new FieldReflector<RarityAndLevelForm>(nameof(Rarity))
                    .SetType(null)
                    .SetDefine((state, field) =>
                    {
                        foreach (var item in GetRarities())
                        {
                            field.AddDescription(item, item.ToString() + " Stars")
                                 .AddTerms(item, item.ToString() + " Stars");
                        }
                        return Task.FromResult(true);
                    }))
                    .AddRemainingFields()
            .Build();
    }

    static List<int> GetRarities()
    {
        var res = HeroService.GetHeroRarities();//List of integer numbers
        return res;
    }
}

}

Here is what should happen and is happening in Web Chat but not in messenger: Working in web chat and emulator but not messenger

Here is what I get in messenger:

Messenger version

I have almost the same code for another form and it works just fine, but for some reason, it's not working for that field. Anyone got an idea how to fix this, because i could not find anything that could help me solve this ?

Ezequiel Jadib
  • 14,767
  • 2
  • 38
  • 43
  • Check you bot framework dashboard issues. – Bob Swager May 12 '17 at 09:58
  • There are no issues it just won't show the bubble buttons in messenger. – Stoyan Grigorov May 12 '17 at 10:05
  • This might gonna help you : http://southworks.com/blog/2016/09/21/using-facebooks-quickreplies-with-promptdialogs/ – Bob Swager May 12 '17 at 12:45
  • I don't see how this could help me with the form problem but tnx for the effort :) – Stoyan Grigorov May 12 '17 at 13:08
  • And this : https://learn.microsoft.com/en-us/bot-framework/dotnet/bot-builder-dotnet-formflow – Bob Swager May 12 '17 at 13:11
  • I have looked at those but they are using enum, which are static , in my case the Rarity options are dynamic so it does not help much. Also for some reason the bot wont display the form message in messenger =/ – Stoyan Grigorov May 12 '17 at 13:13
  • I think that your options must be static. Create static model and fill its fields with values. Than call modelStatic.option to get desired property. – Bob Swager May 12 '17 at 13:24
  • Could you maybe put that idea in some sample code ? Also this https://pastebin.com/PVQzYtSd is another form that follows the first one and it works fine everywhere and all the fields are dynamic and gotten from the same service. So i dont understand why the first form wont display the message and why it wont show the bubbles. Even if you type help for possible options it says nothing. =/ – Stoyan Grigorov May 12 '17 at 13:36
  • I don't work with form flows. I'm using Dialogs because it is easier to manipulate with them than form flows. – Bob Swager May 12 '17 at 14:36
  • @StoyanGrigorov what version of BotBuilder are u using? – Ezequiel Jadib May 12 '17 at 16:15
  • @EzequielJadib SDK version 3.5.5 – Stoyan Grigorov May 12 '17 at 16:19
  • What happens if you make the field a normal one and not a FieldReflector (I know that you won't have the "stars" text but I want to know if even in that case the numbers are not being rendered. Also, can you update to v3.8.0 just to make sure if this still happens in the latest version? – Ezequiel Jadib May 12 '17 at 16:22
  • @EzequielJadib When i try to update everything i get this error http://prntscr.com/f72i73 =/ also i have already removed the stars https://pastebin.com/besMcYJk but the result is the same: no bubbles in messenger and the .Message() wont show in messenger. – Stoyan Grigorov May 12 '17 at 16:26
  • I meant not using FieldReflector, just Field(nameof...). Try updating to 3.5.9 and the to 3.8.1 – Ezequiel Jadib May 12 '17 at 16:30
  • @EzequielJadib here is what i did: i updated only the bot builder sdk to the latest version, published it and now it seems to be working. I tested it a few times and it seems to be ok. http://prntscr.com/f72n90 Thank you so much man, really happy now :) – Stoyan Grigorov May 12 '17 at 16:37
  • I will add the answer if you don't mind :) – Ezequiel Jadib May 12 '17 at 16:40
  • @EzequielJadib ofc, please do so :) – Stoyan Grigorov May 12 '17 at 16:41

1 Answers1

1

Can you please try to update to the latest version of the BotBuilder SDK (currently v3.8.0)? It could be possible that between the version you are using and current one, fixes were made that might affect the behavior you are seeing.

Ezequiel Jadib
  • 14,767
  • 2
  • 38
  • 43