Repository navigation
Webhook receiver - #2049
Webhook receiver#2049matmair wants to merge 20 commits into
Conversation
|
@matmair could you provide a little bit more background on how this webhook architecture would be used? Is this intended to be used directly for third-party integration? I'm afraid I've fallen behind on my reading of the related issues, sorry if I'm asking you to reiterate this. |
|
@SchrodingersGat no problem. This is one of the building blocks for #1421 - 3rd party integration. I will give you an example: I currently develop a IntegrationPlugin that connects InvenTree with Shopify. On startup the plugin checks that it has deployed a webhook-receiver for getting notifications from Shopify. Then it registers the random URL for this endpoint with Shopify's webhook ressource for a couple of events. So each time a order gets created in Shopify a JSON message with all information will be received on the endpoint. The plugin then gets fed this information and uses is to create a SO in InvenTree. The webhook receiver supports inheritance so you only need 4 loc to implement one in a plugin. Because of its usage of the database to define those you can have multiple webhooks per plugin and action as some 3rd parties might require that. |
|
The sample Plugin should be PR ready in a few days so you can try out all pieces working together. |
|
@matmair Wondering how to test the webhooks are functional? I've created an end-point but using the DRF form I'm not able to post a message into that webhook: |
|
@eeintech the unit tests in Then there are three methods of Authentication:
I personally use postman to test the webhooks. |
|
I'm not sure why the DRF form is not working but it seems straightforward otherwise.
All good information that need to go into the doc 😉 |
|
@eeintech my idea would be to hide the whole function from admins because this only safely works if you know what you are doing. With a badly made Plugin one could do arbitrary code execution via a webhook. |
|
@matmair Oh okay so what you are saying is to have hardcoded webhooks instead? Wouldn't it be more flexible to be able to add them dynamically? |
My idea would be to remove the adding function on this specific admin page. |
@eeintech did you get it to run btw? |
|
@matmair Nope but haven't tried harder though |
@SchrodingersGat please this one first - I discovered some security concerns with the plugin system tonight that I am working on addressing. |
|
@SchrodingersGat this is included and improved in #2074 |
|
@matmair ok great, that makes things simpler! I should have some time starting next week to sit down and look at this closely :) |
No hurries 👍 |

Closes #2036
This PR adds a Webhook receiver under the
/api/webhook/<endpoint-id>/URL. The view is designed to be inherited so each step is split into actionable functions. While there is the possibility for the (admin) user to create webhook-endpoints this is in preparation for integrating 3rd party software via plugins.