如何通过环聊聊天中的 webhook 将响应发送到同一线程

Sam*_*a S 3 webhooks google-hangouts

我可以通过应用程序脚本通过 webhooks 向聊天室发送消息,但是我如何发送对该消息的回复。这是一种单向聊天。我如何才能通过 webhooks 将其作为对话流。

小智 9

您可以提供一个threadKey作为查询参数。您可以自己生成此密钥。具有相同内容的消息threadKey被分组在一起。

curl -H 'Content-Type: application/json' -X POST https://chat.googleapis.com/v1/spaces/<space>/messages?key=<key>\&token=<token>\&threadKey=this-thread-rocks --data '{"text": "hi there"}'
Run Code Online (Sandbox Code Playgroud)

请参阅https://developers.google.com/hangouts/chat/reference/rest/v1/spaces.messages/create以获取文档。