A Stream Message is a JSON message that can be sent at a high rate to an elastic group of subscribers.
The unique string that we created to identify the Stream Message resource.
^TZ[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
An arbitrary, schema-less object that contains the Stream Message body. Can be up to 4 KiB in length.
POST https://sync.twilio.com/v1/Services/{ServiceSid}/Streams/{StreamSid}/Messages
Publishes a new message to the Stream. The message contains an arbitrary JSON object that is serialized and percent-encoded as a POST
parameter.
The SID of the Sync Stream to create the new Stream Message resource for.
application/x-www-form-urlencoded
A JSON string that represents an arbitrary, schema-less object that makes up the Stream Message body. Can be up to 4 KiB in length.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createStreamMessage() {11const streamMessage = await client.sync.v112.services("ServiceSid")13.syncStreams("StreamSid")14.streamMessages.create({ data: {} });1516console.log(streamMessage.sid);17}1819createStreamMessage();
1{2"sid": "TZaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"data": {}4}