# 新主题的Webhook返回主题ID，但这与帖子ID不同

**URL:** https://meta.discourse.org/t/webhook-for-new-topic-returns-topic-id-but-this-is-different-from-post-id/282458
**Category:** Support
**Tags:** webhooks
**Created:** [2023年十月16日 22:44 UTC](https://meta.discourse.org/t/webhook-for-new-topic-returns-topic-id-but-this-is-different-from-post-id/282458 "2023-10-16T22:44:52Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ponkie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ponkie/32/333526_2.png) [@ponkie](https://meta.discourse.org/u/ponkie)
#### Post date: [2023年十月16日 22:44 UTC](https://meta.discourse.org/t/webhook-for-new-topic-returns-topic-id-but-this-is-different-from-post-id/282458/1 "2023-10-16T22:44:52Z")

</div>

你好

我想知道目前是否有办法在创建新主题的 webhook 中转发帖子的 ID，或者我是否必须获取所有帖子并与 slug 匹配？

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [2023年十月17日 01:14 UTC](https://meta.discourse.org/t/webhook-for-new-topic-returns-topic-id-but-this-is-different-from-post-id/282458/2 "2023-10-17T01:14:34Z")

</div>

我没有看到任何方法可以从 Topic Event webhook 获取主题的第一个帖子的 ID。`post_id` 未包含在 `web_hook_topic_view_serializer` 或 `topic_view_serializer` 中，因此将其添加到 webhook 的 payload 中需要更改 Discourse 代码。

如果这有帮助，您可以从 Post Event webhook 获取 `topic_id`。也许您可以从那个方向着手解决问题。主题中的第一个帖子将其 `post_number` 设置为 `1`，因此 `post_number: 1` 的 Post Event webhook 将是用于新主题的。
