I'm trying to implement following:
Currently button doesn't send POST.
I forge message with following python script
slack_token = 'xoxp-1111-111-111-qqqqqq'
sc = slack.WebClient(slack_token)
sc.chat_postMessage(
channel="QQQQQ",
blocks=[
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "send post"
}
}
]
}
]
)
I added https://here.aws.api.amazonaws.com/default/lambda as "Request url" in the "Interactive Components" and "Event Subscriptions" of my slack app.
When I send message to bot POST request is sent to aws api.
When I click button POST request is not sent.
Tried with both tokens xoxp- and xoxb-
The problem is: slack generates http request in strange way. Instead of json, it puts "blocks" into following structure:
{ ...... 'body': (byte[])\"payload=%7B%22type%22%3A%22block_actions%2 ...}
after decoding it is equal to:
{...payload={"type": "block_actions",...}
That isn't readable like json. AWS API rejected these slack requests.
AWS cloudwatch helps to investigate problem. To avoid this is necessary to enable "Use Lambda Proxy integration" option during method adding.