If I have a webhook triggered when posting/editing/deleting, is there a way to prevent the webhook from being triggered when doing such an action through Discourse API, by adding an argument to the request or something like that?
That sounds like a terrible idea. The whole point of webhooks is that they fire for all relevant events; letting the originator of that event say whether or not they want the webhook to fire is a recipe for confusion.
Maybe I’m doing wrong, but I believe it would depend on the context. Let’s suppose you create a message from a Wordpress extension to a Discourse forum, usually you treat the response right after the request as it would contain already everything you need; therefore that the originator gets a
post_created event after that is just redundant (it serves no purpose). Having a param to ignore the notification for the originator only doesn’t seem a bad idea.
I’m not seeing a problem worth spending effort on.
Sure, fair enough. This is definitely not a problem itself, more a convenience to not be spammed unnecessarily and avoiding some extra code. Thanks for the answer anyway!