如何使用自定义消息生成器显示在slack中单击按钮的用户名



我试图显示谁点击了"是";以及谁点击了";否";。这是我的密码。

"channel": SLACK_CHANNEL,
"text": "Would you like to promote the build to production?",
"attachments": [
{
"text": "Yes to deploy your build to production",
"fallback": "You are unable to promote a build",
"callback_id": "Put the callback_id for the action",
"color": "#SomeColourHere",
"attachment_type": "default",
"actions": [
{
"name": "deployment",
"text": "Yes",
"style": "danger",
"type": "button",
"value": json.dumps({"approve": True, "codePipelineToken": token, "codePipelineName": codepipeline_name}),
"confirm": {
"title": "Are you sure?",
"text": "This will deploy the build to production",
"ok_text": "Yes",
"dismiss_text": "No"
}
},
{
"name": "deployment",
"text": "No",
"type": "button",
"value": json.dumps({"approve": False, "codePipelineToken": token, "codePipelineName": codepipeline_name})
}  
]
}
] 

有没有什么方法可以显示谁点击了这些按钮。

您提供的详细信息不足,但我可以确认您可以确定是谁点击了按钮。

从外观上看,该代码似乎是遗留下来的。Slack建议现在使用块工具包来构建交互式消息。

对于您的解决方案,当您捕捉到按钮单击引发的事件时,"用户"详细信息作为负载的一部分发送。

请查看此处了解详细信息:https://api.slack.com/legacy/interactive-messages

最新更新