http - Slack Slash 命令获取 Gif 请求

标签 http slack-api slack

我正在尝试使用 slack slash 命令工具为我的团队构建自定义命令。我想在有人使用斜杠命令时调用 GET 请求,而我提供给它查找的 URL 只包含一个 gif。页面的 HTML 被粘贴到 Slack 而不是 gif 本身。如何让斜杠命令改为发布 gif?是否需要在 URL 上使用某种 http 查询来获取响应中的单个 gif?

最佳答案

显示图像而不是 URL 在 Slack 中称为展开。 Slack 对于何时展开链接以及何时不展开链接有一些特殊规则。并且您可以在使用 API 方法时修改该行为(但不能在对斜杠命令的响应中)。

来自文档 Attaching content and links to messages

By default we unfurl all links in any messages posted by users. For messages posted via incoming webhooks or the chat.postMessage API method, we will unfurl links to media, but not other links. (...)

There is one notable exception to these rules: we never unfurl links where the label is a complete substring of your URL minus the protocol. This is so a paragraph of text can contain domain names or abbreviated URLs that are treated as a simple reference, and not a link to be unfurled.

就我个人而言,我发现使用 image_url 标签发布图片最适合附件,您也可以将其用作对斜杠命令的回复。参见 here有关如何使用它们的更多信息。

关于http - Slack Slash 命令获取 Gif 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41644299/

相关文章:

Python 在 MacO 上找不到已安装的模块 slackclient。有什么建议么?

kubernetes - CommonAnnotations 不适用于 AlertManager

slack - 如何为一系列日期设置 Slack 提醒

slack-api - 为 slack 应用程序生成 SLACK_APP_TOKEN

http - AWS CloudFront - 转发用户代理但不对其进行缓存

python - Flask 的 render_template() 问题

java - 如何根据条件更改 HttpServlet 的服务器/主机

apache-flex - 柔性 : HTTP request error #2032

python - 是否可以使用 Python 异步发送许多请求

slack-api - 响应 Slack 消息操作请求时将 'replace_original' 设置为 false 不起作用