环聊聊天监控

问题描述 投票:-1回答:1

我们可以使用API​​来监视组织内环聊中不同用户和群组之间的聊天吗?这将有助于管理员更好地控制组织内部正在传达的内容并控制组织外部。另外,如果存在这些类型的API中的任何一个,在这里我可以获取所有用户的详细聊天记录,请告诉我。

hangout hangouts-chat hangouts-api google-hangouts
1个回答
0
投票

可以通过Gmail API提取Google聊天消息,您可以提出Messages.List请求以从聊天和Gmail中获取所有消息。要仅按聊天中的人过滤,可以使用以下查询q参数:

label:CHAT

通过Messages.Get请求,您可以获取每条消息的数据。

最后,这只会为您提供使用凭据的用户的数据,以获取您需要使用service account with domain wide delegation以便模拟域中每个用户并能够用每个用户的凭据执行上述过程。

编辑

由于您还需要聊天组的信息作为名称和成员,因此您需要使用环聊聊天API并使用此服务帐户凭据设置此应用程序/机器人,如本example中所述,使用Python:

from httplib2 import Http
from oauth2client.service_account import ServiceAccountCredentials
from apiclient.discovery import build
scopes = 'https://www.googleapis.com/auth/chat.bot'
credentials = ServiceAccountCredentials.from_json_keyfile_name(
    'service-account.json', scopes)
chat = build('chat', 'v1', http=credentials.authorize(Http()))
resp = chat.spaces().messages().create(
    parent='spaces/AAAA2CiqVDM', # use your space here
    body={'text': 'Test message'}).execute()
print(resp)

上面的代码发出消息创建请求,但是类似地,您可以使用它来发出其他任何available requests。您也可以使用其他language library

© www.soinside.com 2019 - 2024. All rights reserved.