Webhook for new topic returns topic id but this is different from post id


I was wondering if there is any way to currently forward the post id in the webhook for the creation of a new topic, or do I have to get all posts and match with the slug?

1 Like

I’m not seeing any way to get the ID of the first post of a topic from a Topic Event webhook. The post_id isn’t included in either the web_hook_topic_view_serializer or the topic_view_serializer, so adding it to the webhook’s payload would require a change to the Discourse code.

If it helps, you can get the topic_id from the Post Event webhook. Maybe you could approach the problem that way. The first post in a topic will have its post_number set to 1, so a Post Event webhook with post_number: 1 will be for a new topic.

1 Like