Post a new message to the given stream. The stream can be a chatroom,,an IM or a multiparty IM.
You may include an attachment on the message.
The message can be provided as MessageMLV2 or PresentationML. Both formats support Freemarker templates.
The optional parameter "data" can be used to provide a JSON payload containing entity data. If the message contains explicit references to entity data (in "data-entity-id" element attributes), this parameter is required.
If the message is in MessageML and fails schema validation a client error will be returned.
If the message is sent then 200 is returned.
Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together.
Path parameters
sidstringRequired
Stream ID
Header parameters
sessionTokenstringRequired
Authorization token used to make delegated calls.
keyManagerTokenstringOptional
Key Manager authentication token.
Body
messagestringOptional
The message payload in MessageML.
datastringOptional
Optional message data in EntityJSON.
versionstringOptional
Optional message version in the format "major.minor". If empty, defaults to the latest supported version.
attachmentstring · binaryOptional
Optional file attachment.
previewstring · binaryOptional
Optional attachment preview.
Responses
200
Message sent.
application/json
400
Client error, see response body for further details.
application/json
401
Unauthorized: Session tokens invalid.
application/json
403
Forbidden: Caller lacks necessary entitlement.
application/json
451
Compliance Issues found in message or file
application/json
500
Server error, see response body for further details.
application/json
post
/v4/stream/{sid}/message/create
You can specify one or more attachments to the message. The attachment file can be uploaded along with the message using this endpoint.
Interactive Elements can be sent with your messages. See Sending messages with Symphony Elements section below.
For authentication, you must either use the sessionToken that was created for delegated application access, or both the sessionToken and keyManagerToken together.
You can’t send a message that contains only an attachment without any message content. message must contain a least one space.
DLP (Expression Filters) only works with 1.53 version onwards.
Symphony Elements only works with 1.55.3 version onwards.
To send messages to not public rooms, the caller needs to be part of the stream.
To send numeric cashtags as signals, add a * before the number such as $*122450.
E.g. <messageML><cash tag="*122450"/></messageML>
For more information, refer to Message Format - MessageML.
Attachments: The limit is set to 30Mb total size; also, it is recommended not to exceed 25 files.
For more information on the size limits of messages, please refer to Messages under the section Messages Size Limits.
Sending messages with Symphony Elements
Symphony Elements is a collection of interactive elements that can be sent within messages to facilitate communication with Symphony users.
Through the use of the elements, bots can send messages that contain forms with text fields, dropdown menus, person selectors, buttons and more! To use the Elements, you just need to call the /agent/v4/stream/:sid/message/create API using the MessageML format. For more information and examples, refer to Symphony Elements.
Sending Symphony Elements is only supported for SYSTEM users (Service Accounts).
Important! To support the use of Freemarker variables, the top-level variable name in the div or span tag in <messageML> must be $entity or $data.
Using the Freemarker template, you can also create tables that contain a special column with checkboxes or buttons on it, allowing users to select one or more rows of the table. For more information, refer to Symphony Elements - Table Select.
The first and second examples show the FreeMarker template content enclosed in <messageML> for the message parameter and the associated data model for the data parameter. The third example shows the resulting PresentationML representation of the message.
See also cURL - Message + Data in the examples below.