Skip to content

variant/image/created

Overview

PropertyValue
Webhook typevariant/image/created
Kafka topicvariant.image-created
DirectionPlatform → Your endpoint

Description

Fired when a new image is attached to a variant.

Trigger Conditions

  • An image is uploaded and associated with a product variant via the API

Message Envelope

json
{
  "header": {
    "organizationId": "org_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "messageId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "webhookId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "type": "variant/image/created",
    "date": "2024-03-15T10:23:45.000Z"
  },
  "body": { ... }
}

The body field contains the image object with the parent variant nested.

Note on organizationId resolution: This event uses an organizationIdAccessor pattern — the organizationId is read from data.variant.organizationId.

Body — Property Table

Root Object (VariantImage)

FieldTypeNullableDescription
idstring (uuid)NoUnique image identifier
namestringNoImage file name
typestringNoMIME type (e.g., image/jpeg)
descriptionstringYesOptional description or alt text
bucketstringYesObject storage bucket name
destinationstringYesStorage path/key within the bucket
sourceFilestringYesOriginal upload file name
downloadUrlstringNoPublic CDN URL to access the image
metadataobjectYesArbitrary metadata (JSON)
variantVariantNoThe parent variant (see Variant table)
createdAtstring (ISO 8601)NoCreation timestamp
updatedAtstring (ISO 8601)NoLast update timestamp

Variant Object

FieldTypeNullableDescription
idstring (uuid)NoUnique variant identifier
organizationIdstring (uuid)NoOrganization that owns this variant
productIdstring (uuid)NoParent product identifier
titlestringYesVariant display name
referencestringNoInternal reference code
skustringNoStock keeping unit
modelenumNoPRODUCT or BUNDLE
statusenumYesDRAFT, ACTIVE, ARCHIVED, DISABLED, HOLD
createdAtstring (ISO 8601)NoCreation timestamp
updatedAtstring (ISO 8601)NoLast update timestamp

Full JSON Payload Sample

json
{
  "header": {
    "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "messageId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    "webhookId": "c3d4e5f6-a7b8-9012-cdef-123456789012",
    "type": "variant/image/created",
    "date": "2024-03-15T10:23:45.000Z"
  },
  "body": {
    "id": "f7a8b9c0-d1e2-3456-fabc-789012345678",
    "name": "tshirt-white-m-side.jpg",
    "type": "image/jpeg",
    "description": "Side view of the white t-shirt size M",
    "bucket": "happycolis-media",
    "destination": "variants/d4e5f6a7/tshirt-white-m-side.jpg",
    "sourceFile": "tshirt-white-m-side.jpg",
    "downloadUrl": "https://cdn.example.com/variants/d4e5f6a7/tshirt-white-m-side.jpg",
    "metadata": null,
    "createdAt": "2024-03-15T10:23:45.000Z",
    "updatedAt": "2024-03-15T10:23:45.000Z",
    "variant": {
      "id": "d4e5f6a7-b8c9-0123-defa-234567890123",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "productId": "e5f6a7b8-c9d0-1234-efab-345678901234",
      "title": "Classic White T-Shirt — Size M",
      "reference": "REF-TSHIRT-WHITE-M",
      "sku": "TSHIRT-WHITE-M",
      "model": "PRODUCT",
      "status": "ACTIVE",
      "createdAt": "2024-03-15T09:00:00.000Z",
      "updatedAt": "2024-03-15T10:23:45.000Z"
    }
  }
}

Notes

  • This event uses organizationIdAccessor: (data) => data.variant.organizationId.
  • downloadUrl is a publicly accessible CDN URL.

HappyColis API Documentation