如何在松弛块中返回json对象

问题描述

我是松弛API的新手,我正在创建一个聊天机器人来与我们公司的API进行交互。我想在调用blocks时在chat_postMessage中返回一个json对象。我使用了mrkdwn类型,它返回错误The server responded with: {'ok': False,'error': 'invalid_blocks_format'}。任何人都可以帮忙吗?

部分代码如下:

    def get_UUID_payload(self):
        return {
            "channel": self.channel,"blocks": [
                *self._uuid(),],}
    def _uuid(self):
        response = requests.get(url=f"http://example.com/identifier/uuid/{uuid}")
        response.raise_for_status()
        return {"type": "section","text": {"type": "mrkdwn","text": f"{response.json()}"}}
slack_web_client.chat_postMessage(**message)

解决方法

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

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

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