I think I’m overlooking something, because I know the web gui shows a little mailbox icon, but how do I find out if a topic was mail-in or not? (I want to reply only for mail in)
AI 生成的摘要
In a support discussion titled ‘Detect from topic payload if something was mailed or posted via web,’ carlokok seeks to determine whether a topic was created via email, as the web UI shows a mailbox icon but the webhook payload doesn’t expose this info. zogstrip suggests checking the via_email property on posts, which should be true for email-in posts. However, carlokok confirms that the webhook topic payload doesn’t include this property. zogstrip speculates it might be missing from the webhook serializer, though zogstrip notes the WebHookPostSerializer inherits from PostSerializer, which should include via_email. carlokok clarifies that the topic endpoint only returns topic data — not posts — and that via_email resides on the post object. Ultimately, carlokok resolves to use the API to fetch posts separately to access the via_email flag, marking the issue as solved.
There should be a via_email property set to true on the posts mailed in.
hrmm that’s not what I get via a webhook post data:
{
"topic": {
"id": 13771,
"title": "****",
"fancy_title": "***",
"posts_count": 1,
"created_at": "2017-07-24T19:04:15.000Z",
"views": 0,
"reply_count": 0,
"participant_count": 1,
"like_count": 0,
"last_posted_at": "2017-07-24T19:04:15.000Z",
"visible": true,
"closed": false,
"archived": false,
"has_summary": false,
"archetype": "private_message",
"slug": "****",
"category_id": null,
"word_count": 400,
"deleted_at": null,
"pending_posts_count": 0,
"user_id": 377,
"pm_with_non_human_user": false,
"draft": null,
"draft_key": "topic_13771",
"draft_sequence": 0,
"unpinned": null,
"pinned_globally": false,
"pinned": false,
"pinned_at": null,
"pinned_until": null,
"details": {
"created_by": {
"id": 377,
"username": "**",
"avatar_template": "**"
},
"last_poster": {
"id": 377,
"username": "**",
"avatar_template": "**"
},
"allowed_groups": [
{
"id": 50,
"automatic": false,
"name": "support",
"user_count": 12,
"alias_level": 99,
"visibility_level": 1,
"automatic_membership_email_domains": "",
"automatic_membership_retroactive": false,
"primary_group": false,
"title": "Support",
"grant_trust_level": 4,
"incoming_email": "**",
"has_messages": true,
"flair_url": "fa-cog",
"flair_bg_color": null,
"flair_color": "800000",
"bio_raw": null,
"bio_cooked": null,
"public": false,
"allow_membership_requests": false,
"full_name": null,
"default_notification_level": 3
}
],
"allowed_users": [
{
"id": 377,
"username": "**",
"avatar_template": ""
}
],
"participants": [
{
"id": 377,
"username": "**",
"avatar_template": "",
"post_count": 1,
"primary_group_name": null,
"primary_group_flair_url": null,
"primary_group_flair_color": null,
"primary_group_flair_bg_color": null
}
],
"notification_level": 1,
"can_move_posts": true,
"can_edit": true,
"can_delete": true,
"can_remove_allowed_users": true,
"can_invite_to": true,
"can_create_post": true,
"can_reply_as_new_topic": true,
"can_flag_topic": true
},
"highest_post_number": 1,
"deleted_by": null,
"has_deleted": false,
"actions_summary": [
{
"id": 4,
"count": 0,
"hidden": false,
"can_act": true
},
{
"id": 7,
"count": 0,
"hidden": false,
"can_act": true
},
{
"id": 8,
"count": 0,
"hidden": false,
"can_act": true
}
],
"chunk_size": 20,
"bookmarked": null,
"message_archived": false,
"tags": [],
"featured_link": null,
"topic_timer": null,
"message_bus_last_id": 13,
"can_vote": false,
"vote_count": null,
"user_voted": false
}
}
(stripped the non relevant/private stuff)
Maybe the data is missing from the serializer we’re using when sending a webhook?
Ah sorry; I didn’t realise that would be different from the regular one (they look a lot alike)
Looks like the WebHookPostSerializer is inheriting from the PostSerializer so the via_email property should be there
it looks like the topic endpoint only gets the topic itself, not the posts (the post has via_email)
Consider this solved. I’ll use the API to get the posts to get this imfo