Slack API 通过 webhook 发送命令 [英] Slack API send commands via webhook

查看:36
本文介绍了Slack API 通过 webhook 发送命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定我正在尝试做的事情是否可行.我有一个 Slack 应用程序,我想通过该 SlackApp 控制另一个不是我的 Slack 应用程序.

I am not sure if what I am trying to do is even possible. I have a Slack App and via that SlackApp I want to control another Slack App which is not mine.

这可能太抽象了,让我们详细了解一下:有 SlackApp Foodtrain.如果您是用户,您只需输入/lunchtrain Location Time"即可.我希望我的应用程序激活 Lunchtrain,但如果我只是通过 Webhook 发送一条消息,即/lunchtrain Location Time",它不会激活该命令.你可以在明文中看到它.有没有办法正确地做到这一点?谢谢大家的帮助!

That's probably too abstract, so let's get into detail: There is the SlackApp Foodtrain. If you are a user you just type "/lunchtrain Location Time" and it does it's job. I want my App to activate a Lunchtrain but if I just send a Message via Webhook thats '/lunchtrain Location Time' it doesn't activate the command. You can see it in plaintext. Is there any way to do this properly? Thanks everybody for the help!

推荐答案

官方的 Slack API 不允许你发出斜杠命令,但是有一个未公开的 API 方法叫做 chat.command 具有此功能.

The official Slack API does not allow you to issue slash commands, but there is an undocumented API method called chat.command that has this functionality.

用法示例:

https://slack.com/api/chat.command?token=TOKEN&channel=C123456789&command=/who

查看文档,了解有关此方法的信息详情请见github.

Check out the documentation for the method on this github for details.

这篇关于Slack API 通过 webhook 发送命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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