토픽 이벤트 웹훅 오류: 잘못된 topic_created 메시지 수신

새로운 주제가 생성될 때 특정 작업을 수행하고 싶습니다. 그래서 Topic Events에 대해 웹훅(webhook)을 활성화했습니다. 헤더를 확인하여 topic_created 이벤트인지 확인하고, 해당 이벤트라면 작업을 수행합니다.

이 방식은 몇 달 동안 잘 작동했지만, 지난주 업그레이드 이후로 간헐적으로 실패하는 문제가 발생하고 있습니다. 지금은 헤더에 topic_created가 표시되지만, 실제로는 오래된 주제에 누군가가 답글을 단 경우로 확인됩니다.

제 코드:

    event_type = request.headers['X-Discourse-Event-Type']
    event = request.headers['X-Discourse-Event']
    if event_type == 'topic' and event == 'topic_created':
         take_action()

헤더에 event == 'topic_created'가 포함된 요청의 페이로드 예시입니다. 참고로 “새로 생성된” 것으로 주장되는 이 주제는 실제로 2017년에 생성되었고 306개의 답글이 있습니다.

payload
{
	'bookmarked': False,
	'word_count': 272108,
	'visible': True,
	'like_count': 567,
	'highest_post_number': 758,
	'has_deleted': True,
	'tags_descriptions': {},
	'deleted_at': None,
	'archetype': 'regular',
	'id': 1357,
	'pinned_until': None,
	'archived': False,
	'user_id': 4,
	'title': 'Tax Time! Discussions of Taxes and Accountants',
	'last_posted_at': '2022-01-05T01:41:26.000Z',
	'tags': [],
	'created_by': {
		'username': 'redacted',
		'avatar_template': '/user_avatar/forum.redacted.com/redacted/{size}/45_2.png',
		'id': 4,
		'name': 'redacted'
	},
	'pinned': False,
	'queued_posts_count': 0,
	'closed': False,
	'unpinned': None,
	'participant_count': 162,
	'views': 19557,
	'pinned_at': None,
	'last_poster': {
		'username': 'redacted',
		'avatar_template': '/letter_avatar_proxy/v4/letter/j/45deac/{size}.png',
		'id': 142,
		'name': 'JohnJacobs'
	},
	'pending_posts': [],
	'posts_count': 744,
	'slug': 'tax-time-discussions-of-taxes-and-accountants',
	'thumbnails': None,
	'created_at': '2017-01-21T00:25:01.000Z',
	'deleted_by': None,
	'featured_link': None,
	'reply_count': 306,
	'pinned_globally': False,
	'category_id': 16,
	'fancy_title': 'Tax Time! Discussions of Taxes and Accountants'
}
2개의 좋아요

누군가 이메일로 답변을 남길 때 잘못된 topic_created 메시지가 트리거된다는 증거가 일부 있습니다.

여기 수정 사항을 추가했습니다

1개의 좋아요

이 주제는 18시간 후 자동으로 닫혔습니다. 더 이상 새 답변을 게시할 수 없습니다.