Slack中的Slash命令
在Slack中,是否可以为将消息发布到不同频道的应用程序创建命令? 这就是我要实现的目标: 我从我的DM运行斜线命令,该命令将在频道中发布消息,而我不是我的一部分。 现在,该频道的成员运行另一个命令来回复我,我的回复应由我的应用程序的消息或同一频道中收到,但仅对我可见。 这可以实现吗?
In SLACK, Is it possible to create commands for an app which post messages to different channels?
This is what I am trying to achieve:
I run a Slash command from my DM which will post a message in a channel, which I am not a part of.
A member of that channel now runs another command to reply me and his response should be received by me either in my app’s messages or in the same channel but visible to me only.
Can this be achieved ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
机器人令牌(
xoxb
)可以使用chat.postmessage
[chat:chat:with:witr with: /public] [1] 范围。为此,机器人不需要成为频道的成员。如果您将其用户ID作为channel
参数中的参数传递给chat.postmessage
,则该机器人也可以将1:1 dms发送给用户。要发布到私人频道或多人DM中,它不是成员。要向只能由特定用户查看的通道内发送消息,请查看[CHAT.POSTEPHEMERAL] [1]
,看到此消息的用户必须是频道的成员。A bot token, (
xoxb
) can send messages to any public channel using thechat.postMessage
method and the[chat:write/public][1]
scope. For that, the bot does not need to be a member of the channel. The bot can also send 1:1 DMs to users if you pass their user id as thechannel
parameter in a call tochat.postMessage
but the bot won't be able to post into a private channel or multi-person DM it is not a member of. To send messages in-channel that can only be viewed by a specific user, check out[chat.postEphemeral][1]
, the user seeing this message must be a member of the channel.您在问题中提到的问题可以使用Slack的'互动性'功能。 (slash命令& app快捷方式)
您需要实现代码以捕获“命令”,然后使用Slack的WebApis实现结果。
( chat apis )
What you mentioned in the question can be achieved using Slack's 'Interactivity' features. (Slash Commands & App Shortcuts)
You'll need to implement code to capture 'command', and then use Slack's WebAPIs to achieve the result.
(Chat APIs)