larksuite / larksuite/oapi-sdk-java
飞书接口在飞书卡片中@用户的方法有个坑
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 310
- Forks
- 115
- PR merge metrics
- No merged PRs in 30d
Description
官方文档给出的示例有错误:
card字段应该改为content
另外,飞书消息和飞书卡片中@用户的方式是有区别的:
飞书消息:
<at user_id="xxxx"/>
飞书卡片:
<at id="xxxx"/>
飞书富文本(我没试过):
{
"tag": "at",
"user_id": "xxxx"
}
而在sdk中只找到1中方式:
// com.lark.oapi.service.im.v1.model.ext.MessageText.java
public Builder atUser(String userId, String name) {
sb.append("<at user_id=\\\"")
.append(userId)
.append("\\\">")
.append(name)
.append("</at>");
return this;
}
希望可以增加对其他方式的支持,或者能说明清楚~ 我尝试了好久一直在使用错误的字段=。=
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with com.lark.oapi.service.im.v1.model.ext.MessageText.java and inspect the existing atUser method. Compare its user_id output with the issue's message, card, and rich-text examples, and check the official card example referenced in the report. Done means the supported @ formats or their limitations are clearly addressed without retaining the incorrect card-field guidance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100