# 能否在 user\_badge webhook 的负载中包含用户名？

**URL:** <https://meta.discourse.org/t/could-usernames-be-included-in-user-badge-webhook-payload/413448>\
**Category:** Support\
**Tags:** badges, webhooks\
**Created:** [2026年九月28日 02:25 UTC](https://meta.discourse.org/t/could-usernames-be-included-in-user-badge-webhook-payload/413448 "2026-09-28T02:25:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![burke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/burke/32/4211_2.png) [@burke](https://meta.discourse.org/u/burke)\
**Post date:** [2026年九月28日 02:25 UTC](https://meta.discourse.org/t/could-usernames-be-included-in-user-badge-webhook-payload/413448/1 "2026-09-28T02:25:16Z")

</div>

有没有可能让 `user_badge` Webhook 在返回 `user_id` 的同时也包含 `username`？目前 `user_badge` 事件的负载（payload）看起来是这样的：

```plaintext
{
  "user_badge": {
    "id": 123456,
    "granted_at": "2026-09-25T14:54:42.073Z",
    "created_at": "2026-09-26T05:34:12.965Z",
    "post_id": 234567,
    "post_number": 1,
    "badge_id": 123,
    "user_id": 456,
    "granted_by_id": -1,
    "topic_id": 56789
  }
}

```

要获取 `user_id`（以及如果不是 -1 的 `granted_by_id`）对应的用户名，需要额外调用 `/admin/users/{user_id}.json`。据我了解，这不仅需要额外的请求，还需要管理员权限。

有没有办法在使用 API 密钥的情况下，无需管理员权限即可根据给定的 `user_id` 获取 `username`？

我正在开发一个外部服务，希望能在特定徽章被授予时触发该服务；然而，该服务需要用户名，而徽章 Webhook 只返回用户 ID。😕
