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

Feature: writing Algolia / Search ObjectID back to Saleor #1718

Open
JannikZed opened this issue Jan 28, 2025 · 1 comment
Open

Feature: writing Algolia / Search ObjectID back to Saleor #1718

JannikZed opened this issue Jan 28, 2025 · 1 comment

Comments

@JannikZed
Copy link
Contributor

Currently, the Algolia app is handling just one-way sync from Saleor to Algolia. For deep integration between these two systems, like for user event tracking purposes, we need the ObjectId from Algolia oftentimes.
For example: Algolia can dynamically rank items differently based on popularity and other factors, even on the granularity of user level. To make that work, we need extensive user tracking on several places. Shop systems are often build on a combination of Saleor directly fetching and fetching from Algolia. This mixture makes it sometimes difficult in the event tracking, as you need to have the Algolia ObjectID available on every event. Having the Algolia objectId in the metadata of an item would be really handy, as this would allow us to query for it in the storefront.

This idea should be easy to implement, with not many side-effects, as every webhook update shows us, if we have a metadata entry for AlgoliaObjectId already there and just update it, if it is not there or different to the one we get returned from Algolia.

This change would allow us later also to add an optional new feature, that would send all purchase (order create) event to the Algolia recommend API, to allow server-side event tracking.

@lkostrowski
Copy link
Member

Hey, I think it's a good idea 👍

We will accept the PR.

What we need to ensure:

  1. Error handling → if metadata mutation fails, app must decide what status to report to Saleor. Either 2xx to ignore and accept missing data, or 5xx to ask Saleor to retry. If retry occurs, entire webhook will be called, including algolia call. This can lead to side effect: e.g. older data can overwrite newer write
  2. Async webhook should get product variant metadata in subscription and avoid calling Saleor if it's already set (I assume Algolia ID is stable and doesn't change in time)
  3. Documentation must be updated
  4. Metadata key should be namespaced enough to reduce risk of override by other app. Eg. saleor-app-search:algolia-object-id - and documented

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

No branches or pull requests

2 participants