insertMessage Mutation
Creates a new message in a container (group, action, note, goal, or post).
Access: Requires user access to the container (or workspace if you are inserting using participants)
Parameters:
- _id: Random ID
- workspaceId: ID of the workspace (required for inserting in group container type using participants)
- containerId: ID of the container (id of group, action, note, goal, or post)
- containerType: Type of the container (group, action, note, goal, or post). You should always specify this parameter to avoid errors and confusion.
- body: body of the message, including mentions using <@userId> where userId is the actual userId
- mentions: Array of mentioned user IDs
- attachments: Array of file attachments
- userMentionsByGroup: Array of mentioned group IDs
- userMentionsByTeam: Array of mentioned team IDs
Examples:
- Creating a message in a chat if you know group id: insertMessage( _id containerId - Group ID containerType - 'group' body mentions attachments body = "Hello <@sMoHY5KwWt44Xm8Sw>, how are you?" )
- Creating a message in a DM chat if you know only participants and don't know containerId: insertMessage( _id workspaceId - required for inserting using participants participants - Array of user ids containerType - 'group' mentions attachments body = "Hello <@sMoHY5KwWt44Xm8Sw>, how are you?" )
- Creating a comment in an action: insertMessage( _id containerId - Action ID containerType - 'action'. mentions = ["sMoHY5KwWt44Xm8Sw"] attachments body = "Hello <@sMoHY5KwWt44Xm8Sw>, how are you?" )
Returns the created message with all computed fields.
Arguments
#
_id
workspaceId
containerId
containerType = "group"
Message container type. Only allowed values: action, group, note, workspace, goal, post
participants = []
automated
body
body of the message, including mentions with actual userId like <@sMoHY5KwWt44Xm8Sw>
attachments = []
color
isNoteJsonComment
isPrivate
userMentionsByGroup = []
senderFirstName
Custom sender display name (overrides default user name when sending as an identity)
senderPicture
Custom sender profile picture URL (overrides default user avatar when sending as an identity)
onBehalfOfUserId
If Buzz is authoring the comment on behalf of a human, store that human's user id
Response
#
Returns Message !.
Example
#
insertLink
insertNewsCategory