Silent Messages

Last Edit: Oct 19 2020

Sometimes you want to add system or transactional messages to channels such as: "your ride is waiting for you", "James updated the information for the trip", "You and Jane are now matched" and so on.

You may not want these messages to mark a channel as unread or increase the unread messages for users.

Silent messages are special messages that don't increase the unread messages count nor mark a channel as unread. Creating a silent message is very simple, you only need to include the silent field boolean field and set it to true.


const text = 'You completed your trip';
const message = {
    text,
    user: systemUser,
    silent: true,
    attachments: [{type:'trip', ...tripData}]
};
await channel.sendMessage(message);
                    

val channelController = client.channel("messaging", "channel-id")
val message = Message("text-of-a-message", silent = true)

channelController.sendMessage(message).enqueue {
    val message = it.data()
}
                    

ChannelController channelController = client.channel("messaging", "channel-id");

Message message = new Message();
message.setText("text-of-a-message");
message.setSilent(true);

channelController.sendMessage(message).enqueue(result -> {
    Message message = result.data();
    return null;
});
                    

final text = 'You completed your trip';
const message = {
    text: text,
    user: systemUser,
    silent: true,
    attachments: tripAttachments,
};
await channel.sendMessage(message);
                    

let channel = Client.shared.channel(type: .messaging, id: "general")
let message = Message(text: "You and Jane are now matched!", silent: true)

channel.send(message: message) { (result) in
    // handle result
}
                    
Existing messages cannot be turned into a silent message or vice versa.