microsoft / botframework-sdk

Bot Framework provides the most comprehensive experience for building conversation applications.
MIT License
7.5k stars 2.44k forks source link

[Slack] Interactive Messages not working? #3567

Closed harshil94 closed 7 years ago

harshil94 commented 7 years ago

Issue Description

I am sending the same JSON response to Slack Channel, Facebook Channel and Web Channel (Bot framework in built) to display buttons. It works fine on Facebook messenger and bot framework web chat. But it doesn't display the content as buttons in Slack Channel. Instead, it displays all the buttons with a preceding asterisk. Is slack channel supported with same interactive message components as other channels are currently supported?

EricDahlvang commented 7 years ago

Please share the .json you're sending.

nwhitmont commented 7 years ago

@harshil94 Are you using .NET or Node.js SDK for BotBuilder?

Please post your bot code and associated JSON response so we can better assist you.

harshil94 commented 7 years ago

I am using Node.js SDK for BotBuilder.

Here I am creating a response object from the bot_object given by bot builder. let response = new builder.Message(bot_object);

Then I am adding some data to display imBack Herocards on channel and the final JSON which I am sending in response is something like this.

{
  "type":"message",
  "agent":"botbuilder",
  "source":"slack",
  "address":
    {
      "id":"<channel id>",
      "channelId":"slack",
      "user":
        {
          "id":"<user id>",
          "name":"<user name>"
        },
      "conversation":
        {
          "isGroup":false,
          "id":"<conversation id>"
        },
      "bot":
        {
          "id":"B5E70L1SA:T5C069UQZ",
          "name":"<slack bot name>"
        },
      "serviceUrl":"https://slack.botframework.com"
    },
  "text":"Hello! Will be glad to assist for any help required on below incidents.",
  "suggestedActions":
    {
      "to":[],
      "actions":
        [
          {
            "type":"imBack",
            "value":"Create Ticket",
            "title":"Create Ticket"
          },
          {
            "type":"imBack",
            "value":"Check Status",
            "title":"Check Status"
          },
          {
            "type":"imBack",
            "value":"Reopen",
            "title":"Reopen"
          }
        ]
    }
}

Funny thing is, when I am sending the same response, it shows hero cards on Facebook Messenger as well as WebChat interface of Bot Framework. But it shows the response on slack channel as plain text. See the response on various channels as below:

Facebook messanger UI for Hero card: facebook_herocard

Botframework webchat Interface UI for Hero card: webchat_botframework_herocard

Slack UI for Hero card: slack_herocard

harshil94 commented 7 years ago

Any updates please?

nwhitmont commented 7 years ago

@harshil94 The suggestedActions you have configured in your message object will be displayed differently based on the channel (aka Messenger vs Slack). What you are seeing is the expected behavior of Slack channel.

You can verify this by looking at the Channel Inspector, set on channel: Slack, feature: Suggested Actions slack documentation bot framework

To send Slack-specific formatted messages, you need to put your custom message data in the channelData object of your message.

You can learn more about how to use the channelData under the section Create Full Fidelity Slack Messages: https://docs.microsoft.com/en-us/bot-framework/dotnet/bot-builder-dotnet-channeldata#create-a-full-fidelity-slack-message

harshilt94 commented 5 years ago

I would like to know if there is any way in which we can create simple action/selection buttons in Slack messenger similar to the buttons in Facebook messenger.

Drag13 commented 5 years ago

@harshilt94

I've used Microsoft.Bot.Schema.HeroCard It will looks like this:

image

harshilt94 commented 5 years ago

@Drag13 , does it behave exactly like a button in Facebook messenger?

Drag13 commented 5 years ago

@harshilt94 No idea about Facebook, but this is only one options that works as real buttons in Slack for me.

harshilt94 commented 5 years ago

A button's behavior on Facebook is When you click on a button, the text inside should get populated as a user message as simple text. I want something similar to this.

@Drag13 How does hero card behave on slack? Or is there any other component in slack which can mimic the functioning of button as I explained above?