Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Add attachment_mention rich text element (currently parsed as RichTextUnknownElement, losing url and text)

未关闭
#1,657 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
半天
新手友好度
75/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
java
领域
api

调研方向

Start in GsonRichTextElementFactory, which has no case for attachment_mention and so falls back to RichTextUnknownElement, and follow the existing Canvas element as the pattern for a typed rich text element. Add an AttachmentMention model with url, text, app_id, entity_id, icon_url and the other fields in the issue's JSON sample, register it in the factory, then add a JSON parse test. Done when the sample message parses to the typed element and serializes back with its fields intact.

由索引模型根据 Issue 内容生成。

描述

enhancement project:slack-api-model

Summary
Messages that contain an app-unfurled link (e.g. a Jira Cloud issue link) carry an attachment_mention element inside the rich_text block. GsonRichTextElementFactory has no case for it, so it is deserialized as RichTextUnknownElement. The SDK keeps only type; url, text and the other fields are lost. The element is documented here: https://docs.slack.dev/reference/block-kit/block-elements/attachment-mention-element

Reproduce

Fetch a message that contains a pasted Jira issue link:

GET https://slack.com/api/conversations.replies?channel=C…&ts=…&limit=1
Authorization: Bearer xoxb-…

The raw response contains:

{
  "type": "rich_text",
  "elements": [{
    "type": "rich_text_section",
    "elements": [
      { "type": "text", "text": "read this => " },
      {
        "type": "attachment_mention",
        "url": "https://example.atlassian.net/browse/ABC-5",
        "text": "Issue title",
        "app_id": "A…",
        "entity_id": "W:A…:…",
        "icon_url": "https://product-integrations-cdn.atl-paas.net/jira-issuetype/large/new/task.png",
        "icon_name": "brand-jira-filled",
        "product_name": "Jira Cloud",
        "channel_id": "C…",
        "ts": "…"
      }
    ]
  }]
}

With slack-api-model 1.52.0 the element is parsed as RichTextUnknownElement and serializes back as {"type":"attachment_mention"}. message.text still contains <https://example.atlassian.net/browse/ABC-5|Issue title>, but nothing in blocks carries the link.

Expected

A typed RichTextSectionElement.AttachmentMention (url, text, app_id, entity_id, icon_url, ...) registered in GsonRichTextElementFactory, like Canvas.

Notes

  • slack_sdk (Python) 3.45.0 and @slack/types 3.2.0 don't model it either. The Python SDK has an open draft PR: https://github.com/slackapi/python-slack-sdk/pull/1948
  • I'm happy to open a PR with the model class, the factory entry and a JSON parse test if this is something you'd accept.
Category (place an x in each of the [ ])
  • bolt (Bolt for Java)
  • bolt-{sub modules} (Bolt for Java - optional modules)
  • slack-api-client (Slack API Clients)
  • slack-api-model (Slack API Data Models)
  • slack-api-*-kotlin-extension (Kotlin Extensions for Slack API Clients)
  • slack-app-backend (The primitive layer of Bolt for Java)
Requirements
主要语言
Java
星标
602
派生
235
平均合并
2 天 1 小时
30 天内合并 PR
7

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

slackapi/java-slack-sdk 的其他 Issue

查看 slackapi/java-slack-sdk 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。