How to change a Post-Created Webhook Event Payload

AI-generated summary

The discussion revolves around customizing the payload of a Post-Created webhook event in Discourse. luck7even wants to reduce the payload to only include the topic_title instead of the full post data. singi2016cn expresses a similar need but notes the lack of a straightforward solution. Thefacto suggests three workarounds: using a proxy service to filter the payload, creating a Discourse plugin to modify the event, or using automation tools like Zapier or n8n to extract the desired field. singi2016cn confirms using the proxy method but acknowledges the added complexity of maintenance.

Hello.

I want to customize the payload value of webbook when an event for topic generation occurs.

Example…

AS-IS

{
  "post": {
    "id": 19,
    "name": "user",
    "username": "user",
    "avatar_template": "/letter_avatar_proxy/v2/letter/u/c0e974/{size}.png",
    "created_at": "2018-07-20T06:24:33.205Z",
    "cooked": "<p>Cool, now i have you, haha</p>",
    "post_number": 6,
    "post_type": 1,
    "updated_at": "2018-07-20T06:24:33.205Z",
    "reply_count": 0,
    "reply_to_post_number": null,
    "quote_count": 0,
    "avg_time": null,
    "incoming_link_count": 0,
    "reads": 0,
    "score": 0,
    "topic_id": 11,
    "topic_slug": "this-is-new-topic",
    "topic_title": "This is new topic",
    "display_username": "user",
    "primary_group_name": null,
    "version": 1,
    "user_title": null,
    "moderator": false,
    "admin": true,
    "staff": true,
    "user_id": 1,
    "hidden": false,
    "trust_level": 1,
    "deleted_at": null,
    "user_deleted": false,
    "edit_reason": null,
    "wiki": false,
    "topic_posts_count": 6
  }
}

TO-BE

{
   "topic_title": "This is new topic"
}

Can I know how to do it?

I have a similar need. I also feel confused. There is no good solution at the moment.

Hey, there’s no built-in way in Discourse to send only a tiny part of the webhook payload, but a couple of ideas that might work:

- You could have a small proxy in the middle (like a tiny Node.js or Python endpoint) that gets the full webhook, strips everything except `topic_title`, then forwards it on. Super flexible and doesn’t touch Discourse itself.

- Or, if you’re up for it, a tiny Discourse plugin could listen to `on(:post_created)` and send only the fields you care about. Just a few lines in Ruby and you’re done.

- Another lazy option is to just let a tool like Zapier or n8n grab the full payload and map/filter it before it reaches your final system.

Nothing fancy, just some ways I’d play around if I needed only `topic_title` :slightly_smiling_face:

Yes. I am using the first one, but this requires extra coding and maintenance.