Validation Rules

Rules for valid requests.

2 minPrerequisites: Understand trackResponse()

Problem: trackResponse() throws a validation error and you are not sure which field is causing the problem.

Solution: Two fields are required — type and payload. Everything else is optional.

Required: type

typescript
// Valid
await enterestos.trackResponse({
  type: 'demo_request',
  payload: { email: '[email protected]' }
});

// Invalid — missing type
await enterestos.trackResponse({
  payload: { email: '[email protected]' }
});

Required: payload with at least one field

typescript
// Valid
payload: { email: '[email protected]' }

// Invalid — empty object
payload: {}

Optional: metadata

Metadata is optional. Omitting it entirely is valid. An empty object is also valid.

Not Accepted: status

You cannot set status on creation. All responses start as need_reply. Passing a status field is silently ignored.

Result: You now know the two required fields and can debug validation errors immediately.

Common Questions

What fields are required when calling trackResponse()?

type (a string like 'demo_request') and payload (an object with at least one field). Metadata is optional. Status cannot be set on creation.