Weak Interactive Messages: No Slack POST Response

I create and send a message attachment:

var zz = { "text": "Would you like to play a game??", "attachments": [ { "text": "Choose a game to play", "fallback": "You are unable to choose a game", "callback_id": "wopr_game", "color": "#3AA3E3", "attachment_type": "default", "actions": [ { "name": "chess", "text": "Chess", "type": "button", "value": "chess" } ] } ] } web.chat.postMessage(message.source.channel, '', zz); 

The button message displays well on Slack, but when I press the button, there is no PACK response from Slack to my local ngrok or express route:

app.post('/slackaction', function(req, res)

While other messages send a message to this route.

I see this error from Slack after clicking a button:

 "Oh no, something went wrong. Please try that again" 

Slack Interactive Messages request_url set as: https://xxx.ngrok.io/slackaction

+5
source share
1 answer

Thanks to Taylor Singleary's comments for pointing me in the right direction.

Custom Integrations test tokens or bot tokens can send interactive messages, but you need an application to process them.

To fix this, you need to add the bot to your application here: https://api.slack.com/apps and then get the access token for this bot.

You can use the Slack button generator here: https://api.slack.com/docs/slack-button# to get the OAuth URL and paste it into the browser.

Then from your application process the OAuth stream, save the access token and use it with chat.postMessage.

Then you should receive a POST request when you click on the message buttons.

+5
source

All Articles