Two webhook events sent for some new topics

I have a webhook configured to trigger for topic_created and post_created events. I’ve noticed that some new topics will trigger both, though. This is not true for all topics, but I have noticed it for topics containing uploaded images in their original posts.

In comparing their payloads, the only difference is that the post_created JSON contains a post array (for post_number 1).

This topic from this morning, for example, triggered both events. Here’s the topic_created payload, and the post_created payload.

4 Likes

Hmm anything we can look at here to fix @tgxworld?

1 Like

also… ping @fantasticfears :slight_smile:

Sorry for the late reply. I was away from home. Did you check topic and post event type? If so, topic_created comes from topic event type and post_created comes from post event type. X-Discourse-Event-Type can help to differentiate them. In other words, it’s intended.

But it looks like you are describing another thing. Can you elaborate your configuration?

Both are checked for the same webhook. As I mentioned, this topic triggered both event types when created, one topic_created and one post_created. You can see from the payloads I linked that there was only one post in the topic at the time. As I’ve already worked around the bug, I can’t be sure which other topics have also triggered both upon creation, but this one wasn’t the first.

Let me know if I can do anything to help narrow it down.

If you checked the two event types, all new topics should trigger them twice. As topic event type will trigger topic_created and post event type will trigger post_created.

If the problem is redundant post information, I would note it along with other feedback. Those fields should be either truncated or customized as you mentioned here. :slight_smile:

3 Likes

Strange, I swear I hadn’t noticed two events for most new topics before, but I just created one and both events were triggered. If this is the intended behavior, then it seems to be working. I made accommodations in my script, so all is well either way. :slight_smile:

3 Likes