slack
slack copied to clipboard
Error: MessageAction unmarshalling failed.
This problem happens when the interactive callback is triggered, the program parses the payload of the incoming request. The error is located in slackevents.ParseActionEvent()
.
In slackevents.ParseActionEvent()
function, it uses the struct slackevents.MessageAction
as the target struct, which is only compitible with AttachmentAction, but BlockAction. Unfortunately, my payload includes BlockAction.
AttachmentAction json sample:
"actions": [
{
"name": "game",
"text": "Chess",
"type": "button",
"value": "chess"
}
]
The good thing is that the InteractionCallback
struct has defined to compatible with both AttachmentAction and BlockAction.
BlockAction json sample:
"actions":[
{
"action_id":"action123",
"block_id":"block123",
"text":{
"type":"plain_text",
"text":"Reply to me",
"emoji":true
},
"type":"button",
"action_ts":"1569304306.968465"
}
]
In order to take advantages of the workflow of verifying the token in slackevents.ParseActionEvent()
, I will simply replace MessageAction
with slack.InteractionCallback
in this function to fix the error in my PullRequest.
Did you make a pull request? I have just run into this 2 years later.