-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closes #20003: Introduce mechanism to register callbacks for webhook context #20025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
One bit I'm still not sure about: Should we namespace the context data to avoid collisions among callbacks from different plugins? |
Capturing some points here (I would like to be corrected on anything that I have misunderstood)
The risk is that two plugins define the same key. My instinct tells me to namespace it because even if the risk of collisions is small the user impact is, presulably, large e.g. I get very difficult to solve issues that require me to introspect how NetBox works to figure out |
I have two counterpoints to share:
That said, I have no strong opinion either way. |
Should this be documented, maybe in the webhooks docs: https://netboxlabs.com/docs/netbox/integrations/webhooks/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and works, just wondering about documenting this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re comment on giving the example with namespacing and a note about why you should do this.
Closes: #20003
enqueue_event()
to pass the request object directly (instead of the user & request ID)process_event_rules()
to take a request object rather than a request IDsend_webhook
tasksmodel_name
withobject_type
request
if presentprocess_event_rules()
function for use by pluginswebhook_callbacks
to the NetBox registrysend_webhook()
to gather additional context data from registered webhook callbacks