简体   繁体   English

Twitter是否支持聊天机器人的Webhooks,还是应该使用Stream API?

[英]Does twitter support webhooks for chatbots or should i use Stream API?

I am trying to build a twitter chat bot which is interactive and replies according to incoming messages from users. 我正在尝试构建一个Twitter聊天机器人,该机器人是交互式的,并根据用户的传入消息进行回复。 Webhook documentation is unclear on how do I receive incoming message notifications. Webhook文档尚不清楚如何接收传入的消息通知。 I'm using python. 我正在使用python。

The new Webhooks format (Account Activity API) is currently only available for Direct Messages. 新的Webhooks格式(帐户活动API)当前仅可用于直接消息。 If you have applied for, and been granted, access you can register your webhook receiver and the API will send you incoming direct messages. 如果您已申请并获得访问权限,则可以注册Webhook接收者,API会向您发送传入的直接消息。 This API is currently in beta. 该API目前处于测试阶段。 There's a sample in node on Twitter's developer Github sample repo. Twitter开发人员Github示例存储库上的node中有一个示例

Answering my own question. 回答我自己的问题。 Webhook isn't needed, after searching for long hours on Twitter Documentation, I made a well working DM bot, it uses Twitter Stream API, and StreamListener class from tweepy, whenever a DM is received, I send requests to REST API which sends DM to the mentioned recipient. 不需要Webhook,在Twitter文档上搜索了很长时间之后,我制作了一个运行良好的DM机器人,它使用Twitter Stream API和tweepy的StreamListener类,每当收到DM时,我都会向发送DM的REST API发送请求给提到的收件人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM