You can view any public channel even if you are not a member.
The list is paginated, so to get to the next page, you can pass the ID of the last of the channel objects returned by the previous lookup to get to the next page.
constnumOfRows=20;constresp=awaitclient.getPublicChannels({ limit: numOfRows, category:'important_channels',// optional subcategory:'important_subcategory',// optional});// fetch more channelsif (resp.hasNext) {constlastChannelId=resp.channels[resp.channels.length-1].id;constmoreChannelsResp=awaitclient.getPublicChannels({ lastChannelId, limit: numOfRows, });}// same query but using callbackclient.getPublicChannels({},function(err, resp) {if (resp.hasNext) {constlastChannelId=resp.channels[resp.channels.length-1].id; } });
You can set hasUnread to "true" to see only channels where you have an unread message.
The list is paginated, so to get to the next page, you can pass the ID of the last of the channel objects returned by the previous lookup to get to the next page.
constnumOfRows=20;constresp=awaitclient.getChannels({ limit: numOfRows, category:'important_channels',// optional subcategory:'important_subcategory',// optional isFrozen:false,// optional. filter by isFrozen status hasUnread:true,// optional. only true is supported. when true, shows only unread channels. privateTag:'tag1',// optional. see: https://en.docs.talkplus.io/javascript/channel/member-settings});if (resp.hasNext) {constlastChannelId=resp.channels[resp.channels.length-1].id;constmoreChannelsResp=awaitclient.getChannels({lastChannelId, limit: numOfRows});}// same query but using callbackclient.getChannels({},function(err, resp) {if (resp.hasNext) {constlastChannelId=resp.channels[resp.channels.length-1].id; } });
3. Get Hidden Channels
View currently joined channels that have been marked as hidden.
The list is paginated, so to get to the next page, you can pass the ID of the last of the channel objects returned by the previous lookup to get to the next page.
constnumOfRows=20;constresp=awaitclient.getHiddenChannels({limit: numOfRows});if (resp.hasNext) {constlastChannelId=resp.channels[resp.channels.length-1].id;constmoreChannelsResp=awaitclient.getHiddenChannels({lastChannelId, limit: numOfRows});}// same query but using callbackclient.getHiddenChannels({},function(err, resp) {if (resp.hasNext) {constlastChannelId=resp.channels[resp.channels.length-1].id; } });
Get the total number of unread messages from all joined channels.
// get total unread countconstresp=awaitclient.getUnreadCount();console.log('unreadCount: ',resp.count);// filter unread message count by channel category, subcategory and privateTag.// this feature is available starting from v0.5.6.constfilteredResp=awaitclient.getUnreadCount({ category:'someCategory',// optional subcategory:'someSubcategory',// optional privateTag:'some personal tag',// optional});console.log('filtered unreadCount: ',filteredResp.count);
5. Mark All Channels As Read
Mark as read all unread messages from joined channels.
awaitclient.markAsReadAllChannel();
6. Search Joined Channels
Search joined channels using various filters.
You can filter channels by name, category, subcategory, private tag and joined members. You can set hasUnread to "true" to see only channels where you have an unread message.
The list is paginated, so to get to the next page, you can pass the ID of the last of the channel objects returned by the previous lookup to get to the next page.
constresp=awaitclient.searchChannels({ query:'some channel name', members: ['someUserId1','someUserId2'],// filter by joined members category:'someCategory',// optional subcategory:'someCategory',// optional privateTag:'myTag', isFrozen:false,// optional. filter by isFrozen status hasUnread:true,// optional. only true is supported. when true, shows only unread channels. lastChannelId:'someChannelID', limit:10,});if (resp.hasNext) {// retrieve next page}