将Webhook发布到现有线程 [英] Posting a Webhook to Existing Thread

查看:100
本文介绍了将Webhook发布到现有线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图弄清楚如何在环聊中将Webhook消息发布到聊天室中的现有线程.

Trying to figure out how to have a post a webhook message in Hangouts Chat to an existing thread in a chat room.

当我发布到Webhook URL时,得到以下响应:

When I post to the webhook URL, I get the following response:

{
    "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响应中返回的线程"将其发布到聊天室中的同一线程?

Is there a way to use the returned "thread" in the JSON response to post to the same thread in the chat room?

推荐答案

我知道了.您可以在返回的JSON中获取线程值.

I figured it out. You can take the thread value in returned JSON.

在这种情况下,是:

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

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

And add it to the JSON, you send in your next request:

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

这篇关于将Webhook发布到现有线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆