Botframework-sdk: [C# Skype] Problem with SuggestedActions on Skype

Created on 6 May 2017  ·  15Comments  ·  Source: microsoft/botframework-sdk

Pre-flight checklist

- [x] I have searched the existing issues before logging a new one.

System Information (Required)

  • SDK language (C#)
  • SDK version 3.5.9
  • Development environment - localhost Azure App Service

Issue Description

SuggestedActions don’t work for me on Skype. I tested with the newest sdk and skype version.

Example Code

IMessageActivity reply = context.MakeMessage();
List < CardAction> cardButtons = new List< CardAction>();
CardAction button1 = new CardAction()
{
Type = "imBack",
Title = buttonText1,
Value = buttonText1
};
CardAction button2 = new CardAction()
{
Type = "imBack",
Title = buttonText2,
Value = buttonText2
};
CardAction button3 = new CardAction()
{
Type = "imBack",
Title = buttonText3,
Value = buttonText3
};
CardAction button4 = new CardAction()
{
Type = "imBack",
Title = buttonText4,
Value = buttonText4
};
CardAction button5 = new CardAction()
{
Type = "imBack",
Title = "Cancel ❌",
Value = "Cancel ❌",
};
cardButtons.Add(button1);
cardButtons.Add(button2);
cardButtons.Add(button3);
cardButtons.Add(button4);
cardButtons.Add(button5);
reply.Text = text;
reply.SuggestedActions = new SuggestedActions(actions: cardButtons);

Most helpful comment

I am facing same issue with NodeJS Bot framework. Is there any update on this?

I simply copied this example code.

var msg = new builder.Message(session)
                    .text("Thank you for expressing interest in our premium golf shirt! What color of shirt would you like?")
                    .suggestedActions(
                    builder.SuggestedActions.create(
                        session, [
                            builder.CardAction.imBack(session, "productId=1&color=green", "Green"),
                            builder.CardAction.imBack(session, "productId=1&color=blue", "Blue"),
                            builder.CardAction.imBack(session, "productId=1&color=red", "Red")
                        ]
                    ));
session.send(msg);

Only text message shows up in skype. No suggested actions.

All 15 comments

I closed #2706 because "You need to be on a recent version of Skype - https://web.skype.com/ supports suggested actions so please test there and let us know if you still see an issue." and "A new package with fix #2685 was just published (https://www.nuget.org/packages/Microsoft.Bot.Builder/3.5.9)"

I'm sorry if I closed it prematurely and you are still experiencing this issue with the latest sdk and Skype version.

No problem. It’s probably better this way, since #2706 was about two completely different issues and only the PromptDialog.Choice question is answered.
I experience this problem with the latest SDK and Skype versions (windows 10 and webchat).

3.8.0 and 3.8.1 didn't resolve this issue.
Also the offcial code didn't help https://docs.microsoft.com/en-us/bot-framework/dotnet/bot-builder-dotnet-add-suggested-actions
KeyboardCards are at least rendered as HeroCards, whereas SuggestedActions show nothing on skype.

I can confirm that I am having this issue as well, SuggestedActions show in Skype (latest version) as "Sorry, my bot code is having an issue", they work with the emulator and webchat tester.

This is probably an exception, use ngrok to deploy your bot, change the URL in the Dev Portal to the ngrok One, now you can debug skype and see what exception is being thrown.

Michael

Sent from my Windows 10 phone

From: Edwin Huber
Sent: 05 June 2017 07:49
To: Microsoft/BotBuilder
Cc: Subscribed
Subject: Re: [Microsoft/BotBuilder] [C# Skype] Problem with SuggestedActionson Skype (#2712)

I can confirm that I am having this issue as well, SuggestedActions show in Skype (latest version) as "Sorry, my bot code is having an issue", they work with the emulator and webchat tester.

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

Hi,

there is no exception, I have run it with a debugger attached.
The issue is only seen in Skype, so far I have not seen any exception being thrown.
The same code works fine in the web chat emulator.
I have hooked up ApplicationInsights to confirm that I am not missing an exception.

Code is simple:

var message = context.MakeMessage();
message.TextFormat = TextFormatTypes.Plain;
message.SuggestedActions = new SuggestedActions()
{
Actions = new List()
{
new CardAction(){ Title = TopQ, Type=ActionTypes.ImBack, Value=TopQText },
new CardAction(){ Title = Advisor, Type=ActionTypes.ImBack, Value=AdvisorText },
new CardAction(){ Title = Reading, Type=ActionTypes.ImBack, Value=ReadingText }
}
};
await context.PostAsync(message);

context.Wait(this.OnOptionSelected);

Hi Edwin,

I run your code and discovered that indeed an exception was being thrown, “Activity must include non empty 'text' field or at least 1 attachment".

I added the highlighted code to prevent the exception from being thrown. Basically if Skype replies with Sorry my bot code is having issues, it means it has experienced an unhandled exception.

var message = context.MakeMessage();

message.TextFormat = TextFormatTypes.Plain;

message.SuggestedActions = new SuggestedActions()
{
Actions = new List()
                {
                    new CardAction(){ Title = "TopQ", Type=ActionTypes.ImBack, Value="TopQText"},
                    new CardAction(){ Title = "Advisor", Type=ActionTypes.ImBack, Value="AdvisorText" },
                    new CardAction(){ Title = "Reading", Type=ActionTypes.ImBack, Value="ReadingText" }
                }
};

message.Text = "Test";

await context.PostAsync(message);
context.Wait(OnOptionSelected);

Michael
Sent from Mail for Windows 10

From: Edwin Huber
Sent: 06 June 2017 14:09
To: Microsoft/BotBuilder
Cc: michaelhutchful; Comment
Subject: Re: [Microsoft/BotBuilder] [C# Skype] Problem with SuggestedActionson Skype (#2712)

Hi,
there is no exception, I have run it with a debugger attached.
The issue is only seen in Skype, so far I have not seen any exception being thrown.
The same code works fine in the web chat emulator.
I have hooked up ApplicationInsights to confirm that I am not missing an exception.
Code is simple:
var message = context.MakeMessage();
message.TextFormat = TextFormatTypes.Plain;
message.SuggestedActions = new SuggestedActions()
{
Actions = new List()
{
new CardAction(){ Title = TopQ, Type=ActionTypes.ImBack, Value=TopQText },
new CardAction(){ Title = Advisor, Type=ActionTypes.ImBack, Value=AdvisorText },
new CardAction(){ Title = Reading, Type=ActionTypes.ImBack, Value=ReadingText }
}
};
await context.PostAsync(message);
context.Wait(this.OnOptionSelected);

You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

Many thanks! I was looking at the wrong bot (doh) , and found the exceptions being listed in the botframework portal.
Having included the message in the activity (message.Text) I am at the same point as this issue, the exceptions are gone, but the SuggestedActions are not shown.

I am facing same issue with NodeJS Bot framework. Is there any update on this?

I simply copied this example code.

var msg = new builder.Message(session)
                    .text("Thank you for expressing interest in our premium golf shirt! What color of shirt would you like?")
                    .suggestedActions(
                    builder.SuggestedActions.create(
                        session, [
                            builder.CardAction.imBack(session, "productId=1&color=green", "Green"),
                            builder.CardAction.imBack(session, "productId=1&color=blue", "Blue"),
                            builder.CardAction.imBack(session, "productId=1&color=red", "Red")
                        ]
                    ));
session.send(msg);

Only text message shows up in skype. No suggested actions.

Having the same issue as @prasanna-bigreco with suggested actions not displaying in skype.

Just a short update: Suggested Actions now work on the latest Android version of Skype, but since there are still a lot of Skype versions which don’t show the buttons at all I won’t implement them.

It would be nice if suggested actions are simply rendered as KeyboardCard on all Skype version without support.

Is it possible to know the user's skype version or if it supports this feature?

What's the status for this one? I can only get it to work on Skype for Windows when following this hack -> https://github.com/Microsoft/BotBuilder/issues/3076 ->see Magic73's hack.

The documentation at https://docs.botframework.com/en-us/channel-inspector/channels/Skype?f=SuggestedActions&e=example1 indicates that Suggested Action only works on a card and looks to be the sample @prasanna-bigreco shows above. Is this issue still occurring?

Closing the issue assuming it as resolved. Please reopen a new issue if it still persists.

Was this page helpful?
0 / 5 - 0 ratings