问题描述
我正在尝试向加入我的 Slack 工作区的新用户的入门部分 (check image) 发送欢迎消息。 此外,我无法访问“开始自定义”部分:https://[workspace].slack.com/customize/get-started
我正在收听 team_join 事件,当新用户加入时我会收到此事件,但我只能通过在频道或私人聊天中发送消息来问候他。
如何在此部分中放置消息、窗口或块?
@app.event("team_join")
def ask_for_introduction(logger: logging.Logger,event,say):
logger.debug(event)
welcome_channel_id = "#general"
user_id = event["user"]["id"]
text = f"Welcome,<@{user_id}>! ?"
blocks = [
{
"type": "section","text": {
"type": "mrkdwn","text": "hey there!"
}
},{
"type": "actions","elements": [
{
"type": "button","text": {
"type": "plain_text","text": "Left button","emoji": True
}
},{
"type": "button","text": "Right button","emoji": True
}
}
]
},{
"type": "section","text": "This is a mrkdwn section block :ghost: *this is bold*,and ~this is crossed out~,and <https://google.com|this is a link>"
}
}
]
say(
blocks=blocks,text=text,channel=welcome_channel_id
)
解决方法
此部分已针对新工作区完全删除。 Here is an official Slack support answer
,目前无法通过 API 访问此部分。