Channels are virtual environments where users can communicate with each other and exchange messages. Your application creates channels with a unique id, a name, and a description. You can also save additional properties as custom fields in the channel. These additional properties can be anything you like, such as an image icon, such as a display color, star ratings, moderator names, and more.

State Shape

The data about an individual channel is stored as a slice in a normalized pool of Channels. The following example shows the shape of a list of Channels in the store:

"byId": {
"channel_ac4e67b98b34b44c4a39466e93e": {
"id": "channel_ac4e67b98b34b44c4a39466e93e",
"name": "Introductions",
"description": "This channel is for company wide chatter",
"updated": "2019-11-08T21:42:30.661344Z",
"eTag": "AYr89/Sb5KDi4gE"
"channel_a652eb6cc340334ff0b244c4a39": {
"id": "channel_a652eb6cc340334ff0b244c4a39",
"name": "London Office",
"description": "London Office 🇬🇧",
"updated": "2019-11-08T21:42:30.965912Z",
"eTag": " AfD93cn945yNTA"
show all 18 lines


The PubNub Redux framework provides reducers your app can implement that respond to various actions that update the store. To track the state of a set of objects in the store, combine the reducers you want into the rootReducer for your app.


createChannelDataReducer instantiates a reducer in the store that responds to actions dispatched to update the state of channels in the store.



createChannelsListReducer instantiates a reducer in the store that responds to actions that put a list of channel IDs (as string values) into the store.



The PubNub Redux framework includes listeners that monitor PubNub events from the server and dispatch corresponding actions. All listeners are automatically invoked if your app registers the combined PubNub listener. You can register only specific listeners, or implement your own combine listeners function.


createChannelDataListener registers a listener in the store that monitors channel-related events, such as ChannelDataSet and ChannelDataRemoved, and dispatches corresponding actions to update the store.

A sample implementation of a single listener:



The PubNub Redux framework provides commands that your app can dispatch to the store to be managed by the Thunk middleware. Commands interact with the PubNub API and dispatch basic actions which are then processed by reducers to update the state in the store.


Sets the data associated with a channel.

setChannelData( request, [meta] )

setChannelData Arguments

requestChannelRequestYesChannel request parameter object.
[meta]objectOptionalStandard meta options object.

setChannelData ChannelRequest Properties

channelstringYesUnique identifier of the channel to be created. You won't be able to change the channel ID.
dataobjectYesData for the channel
  [name]stringOptionalDisplay name of the channel.
  [description]stringOptionalDescription of the channel.
  [custom]objectOptionalJSON object of key-value pairs with supported data types. Values must be scalar only; arrays and objects aren't supported.

setChannelData Sample Usage

channel: 'channel_12345',
data: {
name: 'Customer Support',
description: 'Customer Support team member conversations.',
custom: {
location: 'New York',
moderator: 'cwilliams',
space_icon: 'customer_support_icon.png'


Removes the specified channel data.

removeChannelData( request, [meta] )

removeChannelData Arguments

requestRemoveChannelRequestYesChannel request parameters object.
[meta]objectOptionalCommon meta options object.

removeChannelData RemoveChannelRequest Properties

channelstringYesUnique identifier of the channel to be deleted.

removeChannelData Sample Usage

id: 'channel_12345'


Fetch the details of a specific channel.

fetchChannelData( request, [meta] )

fetchChannelData Arguments

requestfetchChannelDataRequestYesChannel request parameter object.
[meta]objectOptionalCommon meta options object.

fetchChannelData fetchChannelDataRequest Properties

channelstringYesID of the channel to fetch.
[include]objectOptionalInclude respective additional fields in the response.
  [customFields]booleanOptionalWhether to fetch custom fields or not.

fetchChannelData Sample Usage

channel: 'channel_12345'


Retrieve a list of channels.

fetchAllChannelData( request, [meta] );

fetchAllChannelData Arguments

requestfetchAllChannelDataRequestYesRequest object contains custom parameters.
[meta]objectOptionalCommon meta options object.

fetchAllChannelData fetchAllChannelDataRequest Properties

limitnumberOptional100Maximum number of results to return per page
filterstringOptionaln/aExpression used to filter the results. Only objects whose properties satisfy the given expression are returned. The filter language is defined here.
sortstringOptionaln/aKey-value pair of a property to sort by, and a sort direction. Available options are updated, id, and name.
Use asc or desc to specify sort direction, or specify null to take the default sort direction (ascending).
For example: {name: 'asc'}
pageobjectOptionaln/aTo get the next set of results, specify next.
To get the previous set of results, specify prev.
If you specify both, prev is ignored.
    next: "next-page-id",
    prev: "prev-page-id"
    customFields: false,
    totalCount: false
Specifies whether to include custom fields in the response, and whether to include a total result count.

fetchAllChannelData Sample Usage

limit: 10,
page: {
next: 'Mg'