This event is fired by the server if a socket user does not have chat scope and thus, can't send chat messages. More precisely, if sender does not have chat.write scope, spaces won't broadcast the message. If you want to toggle this setting, go to Space settings → Permissions → Content creation.

Callback Parameters

NameDescriptionJSON type
content
  • bodyText: (string) message text to send
object
categoryType of message to send, can be: 'chat', 'idea', 'task'string
topicIdUnique identifier of topic to send message to. Note: Direct messages are sent to a topic with only 2 members. To retrieve the topicId for a direct message see /spaces/direct/{userType}/{userId}.string
mentionsarray of user IDs mentionedstring
sender
  • _id: (string) id of the sender.
  • username: (string) sender's username. Email, if registered; a string, if anonymous.
  • displayname: (string) sender's display name.
  • picture_url: (string) sender's picture URL.
  • type: (string) sender's type. Can be either "user" or "anonymous"
object
errorerror typestring

Example

socketConnection.on('SEND_MESSAGE_FAILED', callback(payload));

Payload

{
        "content": {
        "bodyText": "<p>Message text</p>"
        },
    "category": "chat",
    "topicId": "61013fa05f0104ae812e5123",
    "mentions": [],
    "sender": {
        "_id": "61a0f75dc8c54155d05001s2",
    "username": "AnonymousUser",
    "displayname": "AnonymousUser",
    "picture_url": "https://accounts.zang.io/norevimages/noimage.jpg",
    "type": "anonymous"
        },
    "error": "not.authorized.by.topic.policy"
}