Threads & Replies

Last Edit: Feb 02 2020

Threads and replies provide your users with a way to go into more detail about a specific topic.

This can be very helpful to keep the conversation organized and reduce noise. To create a thread you simply send a message with a parent_id. Have a look at the example below:


const reply = await channel.sendMessage({
    text: 'Hey, I am replying to a message!',
    parent_id: parentID,
    show_in_channel: false,
});
                    

// set the parent id to make sure a message shows up in a thread
Message message = new Message();
message.setText("hello world");
message.setParentId(parentMessage.getId());

// send the message to the channel
channel.sendMessage(message, new MessageCallback() {
    @Override
    public void onSuccess(MessageResponse response) {
        
    }

    @Override
    public void onError(String errMsg, int errCode) {

    }
});
                    

let message = Message(text: "Hello world!", parentId: parentMessage.id)
channel.send(message: message).subscribe().disposed(by: disposeBag)
                    

// set the parent id to make sure a message shows up in a thread
Message message = new Message();
message.setText("hello world");
message.setParentId(parentMessage.getId());

// send the message to the channel
channel.sendMessage(message, new MessageCallback() {
    override fun onSuccess(response: MessageResponse) {

    }

    override fun onError(errMsg: String, errCode: Int) {

    }
})
                    

$response = $channel->sendMessage([
		'text' => 'Hey, I am replying to a message!',
		'parent_id' => 'parent-id',
		'show_in_channel' => false
		], 
		'jenny'
	);
                    
If you specify show_in_channel, the message will be visible both in a thread of replies as well as the main channel.