microsoft / BotFramework-Services

Microsoft Bot Framework Services
Creative Commons Attribution 4.0 International
38 stars 11 forks source link

Prompt and Hero Card button does not send the respond back to the bot in Slack #327

Closed aldvintumbelaka closed 2 years ago

aldvintumbelaka commented 2 years ago

Hi,

I'm having a problem where I have prompt button or hero card button in Slack. When the user click the button, it doesn't send any response back to the bot.

Here's my code (using Hero Card) image image

Tested it using step.prompt as well using both Hero Card style or I leave style as undefined image

I try testing it using suggested action as well, but it doesn't render properly in Slack (only render as bullet points) image image

I also have enabled the Event Subscriptions in Slack image

And also enabled Interactivity with https://slack.botframework.com/api/Action as the Request URL

Is there anything that I do wrong on the setup or something? I'm pretty sure I've followed all steps in here https://docs.microsoft.com/en-us/azure/bot-service/bot-service-channel-connect-slack?view=azure-bot-service-4.0

Note: this is working totally fine in Test in Web Chat, in Direct Line, and Microsoft Teams.

Thanks

aldvintumbelaka commented 2 years ago

Found this issue, might be related #326 but looks like it's using Slack interactive message

aldvintumbelaka commented 2 years ago

Hi @youyu16 Yup I've set the webhook URL as well. But, if I set the URL to use https://slack.botframework.com/api/Action as per the documentation, it will not work, but if I set it to my ngrok URL, it will work, but looks like it's missing the request body object that is required by the adapter process activity.

it only has payload, callbackid as the request body. meanwhile, the processActivity required activity_type, etc.

Thanks

youyu16 commented 2 years ago

@aldvintumbelaka any exception occur when you sent that action message? you can find it in web console image

youyu16 commented 2 years ago

Also, if its not work for slack.botframework.com. please check the oauth settings, have you set the endpoint in redirect url image please make sure the interactive is on as below image

youyu16 commented 2 years ago

When I click the button on slack I will get full activity with all the things bot needs and the original message from Slack inside ChannelData Filed. could you please put and example of what you received here?

youyu16 commented 2 years ago

@aldvintumbelaka this is part of the message what I got image

aldvintumbelaka commented 2 years ago

Looks like it's a bit different in mine. Here's the form data for a normal message image

And here's the form data from a button image

aldvintumbelaka commented 2 years ago

@youyu16 The problem is when I try to pass it to the botframework adapter process activity, image

it returns me with this message: validateAndFixActivity(): missing activity type

When i do a check, here's the different between the normal message request body and request body that I got from the slack button when clicked. This is the normal message request body: image

And this is what i got when a button is clicked in slack image

Looks like it's automatically being wrapped inside the payload object.

The problem is, in the process activity function from botframework module, it get the req.body straight away. image

ssss141414 commented 2 years ago

Hi @aldvintumbelaka , I just followed all steps in section Create a Slack application using the Azure portal in the doc, from the scratch: https://docs.microsoft.com/en-us/azure/bot-service/bot-service-channel-connect-slack?view=azure-bot-service-4.0#create-a-slack-application-using-the-azure-portal. This is my test result:

1 For sending hero card, it works well. I can click the button and send back title '1'. I'm using C# SDK and this code should construct the same activity with you provided: image image

2 For sending SuggestedActions, yes I repro the bug. The button is not rendered. We will try to fix it.

Since we're following the same doc, let's assume our configuration is well, so there are 2 suspicious aspects: 1 There are bugs in js SDK. 2 There are bugs in adapter. So I want to know, are you using Slack adapter or Azure portal? I mean in this doc, are you following Create a Slack application using the Azure portal(which I just tested) or Create a Slack application using the Slack adapter?

aldvintumbelaka commented 2 years ago

Hi @youyu16 I'm using the azure portal, not the slack adapter. But, i'm using node js, not the C# SDK. Do you think it might be the issue?

ssss141414 commented 2 years ago

Hi @aldvintumbelaka , Since everything goes well in C# SDK in my side, let me try to use js SDK to see if we can repro it. If can't, this shows we missed something in configuration...

ssss141414 commented 2 years ago

Hi @aldvintumbelaka , I've tried node js SDK, but everything still went well.

I use sample here: https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/javascript_nodejs/02.echo-bot And I use your code: image But everything worked in my side, with bot echoing '1'. image

ssss141414 commented 2 years ago

@aldvintumbelaka , Hi, any update about this issue? Is there more detail that can help us troubleshoot this issue?

aldvintumbelaka commented 2 years ago

Hi @ssss141414 sorry i have a limited internet access during new year break, I'm testing it again now. I'll try to redo all the configuration and do another check.

aldvintumbelaka commented 2 years ago

Hi @ssss141414 I've got it working now. Looks like there is a miss-configuration issue in the redirect url and event subscriptions. Thanks for your help. I'll now close this issue.