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

Use separate webhook per configuration, instead of shared endpoint #725

Open
3 tasks
krzysztofwolski opened this issue Jul 5, 2023 · 0 comments
Open
3 tasks

Comments

@krzysztofwolski
Copy link
Member

The problem I would like to address:

Duplicated email delivery when one of the configurations fails.

Consider setup:

  • User has multiple configurations: two SMTP and two Sendgrid. It's not uncommon to have separate configurations for different channels
  • Saleor sends event webhook
  • One of the configurations time outs or was misconfigured

Currently:

  • all configurations share the same webhook endpoint, for example /api/webhooks/order-created
  • some of the configurations will send an email successfully
  • one of the configurations will throw an error, resulting in non 200 response to the Saleor
  • webhook will retry, causing duplicated email deliveries

Solution:

  • each configuration should have a dedicated endpoint for each event: /api/webhooks/$PROVIDER/$CONFIGURATION_ID/order-created
  • webhooks are dynamically created/removed when the configuration is: created, removed, activated, event is enabled/disabled
  • now, failure of the single configuration will have no impact on others

Additional pros of the proposed solution:

  • we'll be able to modify the payload for every configuration in the future (add/remove keys)
  • less data fetching for each of the webhooks (fetch dedicated configuration instead of all the providers)
  • less complicated code for webhook management - no need to check all the configurations from all providers to determine if webhook would be removed or not

Tasks

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

No branches or pull requests

1 participant