展开Slack中的链接

问题描述

我正在使用松弛的Webhook发送消息。认情况下,如果我发送松弛链接,则它会扩展。 现在,我将使用附件发送链接,我希望它在后面的部分中展开。

enter image description here

这是当前方案。我的有效负载json是:

{
    "attachments": [
        {
            "color": "#f2c744","blocks": [
                {
                    "type": "section","text": {
                        "type": "mrkdwn","text": "*Test Slack* "
                    }
                },{
                    "type": "section","text": "<https://api.slack.com/reference/messaging/link-unfurling|*The test URL*> is in progress."
                    }
                },{
                    "type": "actions","elements": [
                        {
                            "type": "button","text": {
                                "type": "plain_text","text": "Visit Me","emoji": true
                            },"value": "click_me_123"
                        }
                    ]
                }
            ]
        }
    ]
}

我想要的是测试URL 中的链接,该链接在“访问我”按钮之前展开。

enter image description here

所以我希望我在测试URL中给定的链接像行后提到的那样扩展 测试网址正在进行中。 为此,我需要在有效负载json中添加/修改什么?

基本上,当您以这种方式发送链接时:

 attachments=[
        {
            "color": "#f2c744","text": "https://api.slack.com/reference/messaging/link-unfurling"
                    }
                }
    
            ]
        }
    ]

它们不会扩展。我知道可以通过在json上添加urfurl_links:true来解决此问题,但是它对我有用,但是没有块,如何在块中添加呢? 我正在使用python的slack-webhook库。

from slack_webhook import Slack

slack.post(text="text",attachments=[..]

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)