【发布时间】:2021-08-20 09:36:36
【问题描述】:
我正在尝试将欢迎消息发送到 开始使用 部分 (check image),以便新用户加入我的 Slack 工作区。 此外,我无法访问“开始自定义”部分: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": {
"type": "plain_text",
"text": "Right button",
"emoji": True
}
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"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
)
【问题讨论】:
标签: javascript python slack slack-api