There are few messages that need not be prominent as other messages and we and so we created silent messages.
Default syntax is to make the silent parameter true implying a silent message -
const message = await conversation.sendMessage(
{
text:'hi',
unique:userID,
silent: true,
}
);
Any customization can be done to the Message component. Here are some sample user-cases -
Use-case 1 - To have styling for silent messages -
You can achieve this by writing your own message component. Or you could do something like this:
<MessageList
Message=(message) =>
message.silent ?
<YourMessageComponent {...message} />
: <MessageTeam {...message} />
/>
User-case 2 - To have a message like this `<> was added to #this-channel by Seetha`
For this user-case, you need to add the id of the user to the mentioned_users
field of the message object you create when sending the silent message. For example:
const message = {
text: 'was added to #this-channel by @Seetha',
user: userThatSentsIt,
silent: true,
mentioned_users: ['Seetha']
}
Note that the highlighting of mentioned users in a message (i.e. turning the text bold in the default Message components) happens based on the pattern of @<user.name || user.id>
, so make sure the text of the message includes the full username (if available), prepended with an @ character.
Comments
0 comments
Please sign in to leave a comment.