Skip to content
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

[IMP] webhook_outgoing: send outgoing webhooks #13

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

hoangtrann
Copy link

No description provided.

@hoangtrann hoangtrann changed the title [ADD] webhook_(base,incoming): receive and send webhooks [WIP] webhook_(base,incoming): receive and send webhooks Jul 26, 2024
@rvalyi
Copy link
Member

rvalyi commented Jul 26, 2024

Great! Using queue job also seems interesting. I didn't dig deeply into the review yet though, but I might use it and help.

For reference here is the webhook code In Odoo 17.0+ CE (so not available on Odoo 16.0)
https://github.com/odoo/odoo/blob/master/addons/base_automation/models/base_automation.py#L98

(usage can be seen here https://medium.com/@karan.bk/simplify-integration-with-odoo-17-using-webhooks-4ec56c46fcb3)
This is not a lot of code; eventually there are some ideas to get, eventually some sort of compatibility can be achieved.

EDIT: to achieve some kind of compatibility, from a quick overview:

cc @pedrobaeza @sebastienbeau @hparfr @sbidoul @lmignon @simahawk @etobella

@rvalyi
Copy link
Member

rvalyi commented Jul 26, 2024

there is also possibly some overlap with https://github.com/OCA/web-api/blob/14.0/webservice/models/webservice_backend.py from the https://github.com/OCA/web-api/tree/14.0 OCA project. In any case, quick and dirty web hooks with no code is certainly something important to have for simple and quick automation.

@rvalyi
Copy link
Member

rvalyi commented Jul 26, 2024

it can also be installed as an option, but eventually this server_action_logging module might help.

@rvalyi
Copy link
Member

rvalyi commented Jul 29, 2024

BTW, @gurneyalex pointed that the security of the native Odoo v17 web hooks is probably not so good: https://x.com/gurneyalex/status/1817900552329560150 ...

So good if this extra module could bring some real security... Is it safe now https://github.com/OCA/webhook/pull/13/files#diff-ca6b9e897fddbb1f998aefd239a9630cef55fbdcd6de7a2b20043e2faff24b29R28 ?

Eventually, we might use base_rest_auth_api_key https://github.com/OCA/rest-framework/tree/16.0/base_rest_auth_api_key may be ?

@ivs-cetmix
Copy link
Member

@hoangtrann @rvalyi looks like `codecov/project' action is still running. It will consume tons of minutes

@ivs-cetmix
Copy link
Member

also @sbidoul please have a look at the codecove job here

@hoangtrann hoangtrann changed the title [WIP] webhook_(base,incoming): receive and send webhooks [IMP] webhook_(base,incoming): receive and send webhooks Aug 6, 2024
@hoangtrann
Copy link
Author

@ivs-cetmix force push to trigger actions seem to solve the issue

Copy link
Member

@ivs-cetmix ivs-cetmix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you once again for your contribution. Some thoughts here:

  • Probably the first module should be named something like webhook_outgoing for better matching the module designation. Same for the module name and description
  • Maybe it would be better to have 2 different PR's per module. You can add dependencies in the second PR using test-requirements.txt. This will make reviews and merging modules faster
  • Test coverage is something that is a must so tests should be added in order to proceed further
  • Same with documentation. However this is something we can also assist with

"license": "LGPL-3",
"website": "https://github.com/OCA/webhook",
"depends": [
"base",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this dependency because "base_automation" already depends on "base".


state = fields.Selection(
selection_add=[("custom_webhook", "Custom Webhook")],
ondelete={"custom_webhook": "cascade"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an issue, just curios: how does this work in selection fields?

"author": "Hoang Tran,Odoo Community Association (OCA)",
"license": "LGPL-3",
"website": "https://github.com/OCA/webhook",
"depends": ["base", "base_automation", "webhook_base", "queue_job"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"webhook_base" already depends on "base_automation" so no need to add "base" and "base_automation" here

@hoangtrann hoangtrann changed the title [IMP] webhook_(base,incoming): receive and send webhooks [IMP] webhook_outgoing: send outgoing webhooks Aug 26, 2024
@hoangtrann
Copy link
Author

thanks @ivs-cetmix @rvalyi for your feedback, I've updated the PR to only include the webhook_outgoing for sending out webhook requests.

I've made changes accordingly as well:

  • Merge with ir.actions.server, all fields are brought to this model
  • I'd like to keep webhook.logging for now to log information that we can relate directly to the webhook

I'm going to update the tests as well as creating another PR for incoming webhook

@agent-z28
Copy link

@hoangtrann lets get it merged ! it's really great.

Copy link

@lmignon lmignon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this addons. Can you add tests plz? Unittest are required to ensure code quality and maintainability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants