将 Webhook 发布到现有线程

Posting a Webhook to Existing Thread

试图弄清楚如何在环聊聊天中向聊天室中的现有线程发送 post webhook 消息。

当我 post 到 webhook URL 时,我得到以下响应:

{
    "name": "spaces/123123123123/messages/128391203812903809128",
    "sender": {
        "name": "users/u4i3u4oi32u5oi23u4o23",
        "displayName": "Mecha",
        "avatarUrl": "",
        "email": "",
        "type": "BOT"
    },
    "text": "",
    "cards": [
        {
            "header": {
                "title": "Some Title",
                "subtitle": "Some Subtitle",
                "imageStyle": "IMAGE",
                "imageUrl": "Some Image URL",
                "imageAltText": ""
            },
            "sections": [],
            "cardActions": [],
            "name": ""
        }
    ],
    "previewText": "",
    "annotations": [],
    "thread": {
        "name": "spaces/123123123123/messages/128391203812903809128"
    },
    "space": {
        "name": "spaces/123123123123",
        "type": "ROOM",
        "displayName": "Chat Room"
    },
    "fallbackText": "",
    "argumentText": "",
    "createTime": "2019-01-25T21:13:03.278543Z"
}

有没有办法在 JSON 对 post 的响应中使用返回的 "thread" 到聊天室中的同一线程?

我明白了。您可以在返回的 JSON 中获取线程值。

在这种情况下,它是:

"thread": {
        "name": "spaces/123123123123/messages/128391203812903809128"
    },

并将其添加到 JSON,您发送下一个请求:

{ 
  "cards": [
    {
        "header": {
            "title": "Some Title",
            "subtitle": "Some Subtitle",
            "imageStyle": "IMAGE",
            "imageUrl": "Some Image URL",
            "imageAltText": ""
        },
        "sections": [],
        "cardActions": [],
        "name": ""
    }
 ],
  "thread": {
        "name": "spaces/123123123123/messages/128391203812903809128"
    }
}