简体   繁体   English

我可以将 Slack 事件 API 与斜杠命令一起使用吗?

[英]Can I use Slack events API with slash commands?

I want to use slash commands in Slack to integrate with an external API.我想在 Slack 中使用斜杠命令与外部 API 集成。 In the API I need to verify a request from Slack.在 API 中,我需要验证来自 Slack 的请求 The docs suggest that I should use the Python Events API SDK for that.文档建议我应该为此使用Python 事件 API SDK Can anyone explain how exactly I should use that API?谁能解释我应该如何使用 API? Can I listen for a particular event corresponding to slash commands, or should I somehow reuse the request verification code from that API?我可以侦听与斜杠命令相对应的特定事件,还是应该以某种方式重用来自该 API 的请求验证码?

The docs suggest that you should aim to re-use an existing library that handles the signed secret verification, rather than writing your own code to do it, it possible.文档建议您应该致力于重用处理签名秘密验证的现有库,而不是编写自己的代码来完成它,这是可能的。

But if none of the suggested libraries work you, I would suggest to rather write that code yourself then introducing a large library with 99% functions that you do not need.但是,如果建议的库都不适合您,我建议您自己编写该代码,然后引入一个包含 99% 不需要的函数的大型库。 Especially since the algorithm is not that complex.特别是因为算法并不复杂。

And no, Events and Slack commands are different concepts.不,Events 和 Slack 命令是不同的概念。 So there is not slash command event to listen for.所以没有斜线命令事件可以监听。

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

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