Shopify Events fields_changed: only added should start a Sume job

Shopify Events' fields_changed is now an object with added, updated and removed. Start a paid Sume job from added only, and key it so replays are safe.

4 min readSume
All posts

Shopify's changelog turns fields_changed from a flat array into an object with added, updated and removed arrays. For a handler that spends money, read only fields_changed.added when you want a new image or clip, and ignore updated and removed; a price edit or a deleted variant should not start a Sume job.

Payload details are from Shopify's Events payloads changelog, read 2026-10-01; retry rules from Sume's Jobs and results docs.

What changed in the payload?

Shopify says developers can now tell a resource or relationship being added, a value updated, or something removed, without a follow-up query. Its example: adding a variant to a product keeps the product's action as update and puts the variant path in fields_changed.added.

fields_changed arrays and the Sume action, Shopify changelog read 2026-10-01.
ArrayMeaningStart a Sume job?
addedResource or relationship addedYes, if it needs media
updatedA value changedNo
removedResource or relationship removedNo

How do I filter in the handler?

Read the array, keep the paths you care about, and derive one key per path so the same added variant never maps to two jobs. Shopify's example path has the form product[id: '...'].variants[id: '...'].

function pathsToRender(payload) {
  const added = payload.fields_changed?.added ?? [];
  return added.filter((path) => path.includes(".variants["));
}

async function submit(path) {
  return fetch("https://api.sume.com/v1/images", {
    method: "POST",
    headers: {
      Authorization: "Bearer " + process.env.SUME_API_KEY,
      "Content-Type": "application/json",
      "Idempotency-Key": "variant:" + path,
    },
    body: JSON.stringify({
      model: "openai/gpt-image-2.5",
      prompt: "Studio photo of the new variant on a plain background",
    }),
  });
}

Why use an idempotency key on the Sume call?

Deliveries can repeat and your handler can time out. Sume's docs say a retry of a submit should reuse the same Idempotency-Key so it returns the original job instead of billing a second one, and not to submit a new paid job for the same intent. On the video route, a replay returns the original job. Never build the key from a timestamp.

What about the headers Shopify removed?

The same changelog removes shopify-event-id and shopify-resource-id from Events deliveries and says to drop any code that depends on them. That is why the key above comes from the payload path. More in dedupe on the Sume job id, and the wildcard trigger syntax in one image per new variant.

Sources

Related posts

More in Integrations

All Integrations posts

Written by Sume