---
source_url: https://www.pubnub.com/docs/sdks/redux/api-reference/channels
title: Channels API
updated_at: 2026-06-26T11:06:44.937Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Channels API

*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:

```json
{
  "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"
    },
  }
}
```

## Reducers

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

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

```tsx
createChannelDataReducer();
```

### createChannelsListReducer

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

```tsx
createChannelsListReducer();
```

## Listeners

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

`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:

```tsx
pubnub.addListener(createChannelDataListener(store.dispatch));
```

## Commands

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.

### setChannelData

Sets the data associated with a channel.

```tsx
setChannelData( request, [meta] )
```

#### setChannelData arguments

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| request | ChannelRequest | Yes |  | Channel request parameter object. |
| [meta] | object | Optional |  | Standard meta options object. |

#### setChannelData ChannelRequest properties

| Property | Description |
| --- | --- |
| `channel` *Type: `string` | Unique identifier of the channel to be created. You won't be able to change the channel ID. |
| `data` *Type: `object` | Data for the channel |
| `[name]`Type: `string` | Display name of the channel. |
| `[description]`Type: `string` | Description of the channel. |
| `[custom]`Type: `object` | JSON object of key-value pairs with supported data types. Values must be scalar only; arrays and objects aren't supported. |

#### setChannelData sample usage

```javascript
dispatch(setChannelData({
  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'
    }
  }
}));
```

### removeChannelData

Removes the specified channel data.

```tsx
removeChannelData( request, [meta] )
```

#### removeChannelData arguments

| Parameter | Description |
| --- | --- |
| `request` *Type: `RemoveChannelRequest` | Channel request parameters object. |
| `[meta]`Type: `object` | Common meta options object. |

#### removeChannelData RemoveChannelRequest properties

| Property | Description |
| --- | --- |
| `channel` *Type: `string` | Unique identifier of the channel to be deleted. |

#### removeChannelData sample usage

```javascript
dispatch(removeChannelData({
  id: 'channel_12345'
}));
```

---

### fetchChannelData

Fetch the details of a specific channel.

```tsx
fetchChannelData( request, [meta] )
```

#### fetchChannelData arguments

| Parameter | Description |
| --- | --- |
| `request` *Type: `fetchChannelDataRequest` | Channel request parameter object. |
| `[meta]`Type: `object` | Common meta options object. |

#### fetchChannelData fetchChannelDataRequest properties

| Property | Description |
| --- | --- |
| `channel` *Type: `string` | ID of the channel to fetch. |
| `[include]`Type: `object` | Include respective additional fields in the response. |
| `[customFields]`Type: `boolean` | Whether to fetch `custom` fields or not. |

#### fetchChannelData sample usage

```javascript
dispatch(fetchChannelData({
  channel: 'channel_12345'
}));
```

### fetchAllChannelData

Retrieve a list of channels.

```tsx
fetchAllChannelData( request, [meta] );
```

#### fetchAllChannelData arguments

| Parameter | Description |
| --- | --- |
| `request` *Type: `fetchAllChannelDataRequest` | Request object contains custom parameters. |
| `[meta]`Type: `object` | Common meta options object. |

#### fetchAllChannelData fetchAllChannelDataRequest properties

| Parameter | Description |
| --- | --- |
| `limit`Type: `number`Default: 100 | Maximum number of results to return per page |
| `filter`Type: `string`Default: n/a | Expression used to filter the results. Only objects whose properties satisfy the given expression are returned. The filter language is [defined here](https://www.pubnub.com/docs/general/metadata/filtering). |
| `sort`Type: `string`Default: n/a | Key-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'}` |
| `page`Type: `object`Default: n/a | To 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"` `}` |
| `include`Type: `object`Default: `{` `customFields:` `false,` `totalCount`: `false` `}` | Specifies whether to include custom fields in the response, and whether to include a total result count. |

#### fetchAllChannelData sample usage

```javascript
dispatch(fetchAllChannelData({
  limit: 10,
  page: {
    next: 'Mg'
  }
}));
```