DocumentIndex icon
DiscordIncomingWebhook icon
Webhook icon

Instant Product Upsert to Typesense from a PIM Webhook

Index product updates into Typesense the moment a PIM webhook fires with Kestra. One DocumentIndex upsert makes edits searchable in milliseconds.

Categories
BusinessData

Nightly rebuilds keep a search index correct; webhooks keep it current. This blueprint closes the gap between saving a product in the PIM and seeing the change in storefront search. The PIM POSTs the changed product to a Kestra webhook, io.kestra.plugin.typesense.DocumentIndex upserts a single document into the products collection, and Discord confirms which product landed. Because the document id is the product identifier, repeated updates overwrite the same document instead of duplicating it.

How it works

  1. The pim_update trigger (io.kestra.plugin.core.trigger.Webhook) accepts a POST from the PIM, secured by the webhook key. Replace change-me-strong-webhook-key with a strong random value before exposing the URL.
  2. upsert_product (io.kestra.plugin.typesense.DocumentIndex) builds the document map field by field. Each value prefers the webhook body via {{ trigger.body.field ?? inputs.field }}, so the same flow serves webhook-driven upserts and manual runs; flow inputs with defaults act as the fallback and as living documentation of the expected payload shape.
  3. confirm posts the product id and name to Discord, and the errors block posts a distinct alert when the upsert fails, because a lost PIM edit is invisible until a customer searches for it.

The connection uses the Typesense default port 8108 as a plain value and https: false for a local or private-network cluster; set https: true when your production cluster terminates TLS.

What you get

  • PIM edits searchable in milliseconds instead of waiting for the nightly rebuild.
  • Upsert semantics keyed on the product id, so retries and duplicate webhooks are harmless.
  • A flow you can execute manually with the input defaults to smoke test the connection.
  • A Discord confirmation per update and an alert per failure.

Who it's for

  • E-commerce teams whose merchandisers expect a price or stock edit to show up in search immediately.
  • Platform engineers wiring PIM, ERP, or commerce platform webhooks into Typesense without writing a service.
  • Search engineers pairing a realtime upsert path with a nightly full rebuild.

Why orchestrate this with Kestra

A webhook receiver for one document sounds like a ten-line service, until it needs authentication, retries, an audit trail, and someone to notice when it breaks. Kestra provides the keyed webhook endpoint, keeps every received payload in the execution history, retries transient Typesense errors, and alerts on failure, all in declarative YAML next to the rest of your search pipelines.

Prerequisites

  • A running Typesense cluster and an existing products collection whose schema matches the document fields; the nightly catalog index blueprint contains the curl call that creates it.
  • A PIM or commerce platform able to POST JSON to a URL on product save.
  • A Discord incoming webhook for confirmations and alerts.

Secrets

  • TYPESENSE_HOST: hostname or IP of the Typesense node or load balancer.
  • TYPESENSE_API_KEY: an admin API key with write access to the collection.
  • DISCORD_WEBHOOK_URL: Discord incoming webhook URL.

Quick start

  1. Add the three secrets to your Kestra namespace and replace the webhook key with a strong random value.
  2. Execute the flow manually once; the input defaults upsert a sample product and Discord confirms it.
  3. Point your PIM at https://your-kestra/api/v1/executions/webhook/company.team/typesense-instant-product-upsert/<your-key> with a JSON body containing product_id, name, brand, category, price, popularity, and in_stock.
  4. Search for the product in Typesense to confirm the round trip.

How to extend

  • Map additional PIM fields into the document map after adding them to the collection schema.
  • Add an If task that skips indexing for draft or unpublished products based on a webhook body field.
  • Pair with the nightly catalog index blueprint so the full rebuild corrects any drift the realtime path misses.
  • Route confirmations to a low-noise channel and keep the failure alert on the on-call channel.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.