Is there any way to prevent triggering a webhook when using API?


(Coin-coin le Canapin) #1

Hi,
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?


(Matt Palmer) #2

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.


#3

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.


(Matt Palmer) #4

I’m not seeing a problem worth spending effort on.


#5

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!