Skip to content

Envelope

Envelope<TPayload> = object

Defined in: packages/postal/src/envelope.ts:19

Standard message wrapper used internally and exposed to subscribers.

Envelopes are the unit of communication in postal. Subscribers receive the full envelope, and transports serialize/deserialize them when bridging across execution boundaries.

TPayload = unknown

channel: string

Defined in: packages/postal/src/envelope.ts:25

The channel this message was published on


optional correlationId: string

Defined in: packages/postal/src/envelope.ts:37

Present on ‘reply’ envelopes — correlates back to the original request


id: string

Defined in: packages/postal/src/envelope.ts:21

Unique message identifier (UUID v4)


payload: TPayload

Defined in: packages/postal/src/envelope.ts:29

The message payload


optional replyTo: string

Defined in: packages/postal/src/envelope.ts:35

Present on ‘request’ envelopes — the topic to send the reply to


optional source: string

Defined in: packages/postal/src/envelope.ts:33

Originating context identifier, set by transports to track message origin


timestamp: number

Defined in: packages/postal/src/envelope.ts:31

When the envelope was created — Date.now() for serialization safety


topic: string

Defined in: packages/postal/src/envelope.ts:27

The dot-delimited topic string


type: EnvelopeType

Defined in: packages/postal/src/envelope.ts:23

The kind of message