githubEdit

square-caret-downCustomEventPayloadInput

CustomEventPayloadInput Input Type

Audience: Programmer

A structured input type for custom event payloads in the pyck event system. This input type provides a standardized way to send custom events with a required entity identifier and optional additional data.

Fields

Field
Type
Required
Description

id

ID!

Yes

The identifier of the entity this event relates to

data

Map

No

Optional additional data and context information

Field Details

id (required)

The id field is the primary identifier for the entity that the custom event relates to. This could be:

  • An inventory item ID

  • A customer ID

  • A picking order ID

  • A device ID

  • Any other entity identifier in the system

This field is required to ensure events are properly associated with entities and can trigger appropriate workflows.

data (optional)

The data field accepts a flexible Map (JSON object) that can contain any additional context information for the event. This allows for:

  • Custom attributes specific to your event type

  • Nested objects for complex data structures

  • Arrays for lists of related items

  • Any JSON-compatible data types

Usage

This input type is used exclusively with the sendCustomEvent mutation.

Example

Basic Usage

Minimal Payload (ID only)

When you only need to identify the entity without additional data:

Complex Data Structure

JavaScript Example

Migration from Map Payload

If you were previously using the Map type for payloads, you need to restructure your data:

Before (deprecated):

After (current):

Best Practices

  1. Use meaningful IDs: The id field should reference a valid entity in your system

  2. Keep data structured: Organize related fields into nested objects for clarity

  3. Avoid sensitive data: Do not include passwords, API keys, or other secrets in the data field

  4. Document your schemas: Maintain documentation for the data structure expected by each event type

  5. Validate client-side: Validate the payload structure before sending to catch errors early

Service

This input type is defined in the Management service.

Last updated

Was this helpful?