Unable to post interactive messages using postMessage
rahulserver opened this issue · comments
Slack.chat.postMessage({token: "a valid private token",text: "test text", attachments: [{
"callback_id": "tender_button",
"attachment_type": "default",
"actions": [
{
"name": "press",
"text": "Press",
"type": "button",
"value": "pressed"
}
]
}], channel: req.body.channel_id})
I am trying to post an interactive message with a button based on https://api.slack.com/interactive-messages
But all I get is a simple text message which says "test text".
I wonder why isn't the button attachment appearing in the message.
think you have an invalid format. try a payload like this?
let token = 'xx'
let channel = 'xxx'
let text = 'descriptive text'
let attachments = [{
text: "Choose a game to play",
fallback: "You are unable to choose a game",
callback_id: "wopr_game",
attachment_type: "default",
actions: [{
name: "game",
text: "Chess",
type: "button",
value: "chess"
}]
}]
await slack.chat.postMessage({token, channel, text, attachments})