--- title: "Producing messages" description: "Producing messages — Node.js BabelQueue SDK (1.x)." source: https://babelqueue.com/docs/babelqueue-node/1.x/producing-messages/ updated: 2026-06-06T00:00:00.000Z --- # Producing messages Build the canonical envelope with `EnvelopeCodec.make`, encode it to JSON with `EnvelopeCodec.encode`, then publish the bytes with your own broker client. ```ts import { EnvelopeCodec } from "@babelqueue/core"; const env = EnvelopeCodec.make( "urn:babel:orders:created", { order_id: 1042, amount: 99.90 }, { queue: "orders" }, ); const body = EnvelopeCodec.encode(env); // compact UTF-8 JSON string // await redis.rpush("queues:orders", body); // / channel.sendToQueue("orders", Buffer.from(body)); ``` CommonJS works too: `const { EnvelopeCodec } = require("@babelqueue/core")`. `encode` produces the canonical `schema_version: 1` envelope, with `meta.lang` set to `"node"`: ```json { "job": "urn:babel:orders:created", "trace_id": "7b3f9c2a-e41d-4f88-9b2a-1c0d5e6f7a8b", "data": { "order_id": 1042, "amount": 99.90 }, "meta": { "id": "f1e2d3c4-b5a6-4789-90ab-cdef01234567", "queue": "orders", "lang": "node", "schema_version": 1, "created_at": 1749132727000 }, "attempts": 0 } ``` Next: [Consuming messages](/docs/babelqueue-node/1.x/consuming-messages/).