Channel Metadata

Manage channel data with BizOps Workspace

Use BizOps Workspace in the Admin Portal to create, edit, or delete channels and their data. It lists all channels on your app’s keysets.

The App Context service lets you store metadata for channels, channel memberships, channel members, and users.

Channel metadata has built‑in name and description fields. You can also add a custom object with extra attributes your app needs on the PubNub platform.

Illuminate & sensitive data

You can track App Context data in Illuminate for real‑time analytics.

Illuminate uses JSON paths and mapping when you create Business Objects. Avoid PII in custom fields, such as email addresses, profile URLs, or IP addresses.

Channel metadata

The App Context service emits events when a channel’s metadata is set or deleted. Your app can receive these events in real time and update the UI.

The next sections show what you can do with channel metadata.

Set channel metadata

You can set built‑in and custom metadata by providing key/value pairs.

API limits

To learn about the maximum length of parameters used to set channel metadata, refer to REST API docs.

The code below adds the name, description, and custom owner information to the channel my_channel.

pubnub.objects.setChannelMetadata({
channel: "my_channel",
data: {
name: "main channel",
description: "This channel is for company wide chatter.",
custom: { "owner": "johndoe_1" }
}
});

On success, the SDK returns the same metadata object with status 200. It also fires an objectschannelset event for other clients. See Init & Add Listener.

Get channel metadata

Provide the channel ID to get its metadata. You can also include custom metadata in the response. The example below returns all metadata for my_channel.

pubnub.objects.getChannelMetadata({
channel: "my_channel"
});

On success, the PubNub SDK returns the metadata of the specified channel along with status 200.

Get metadata for all channels

You can get metadata for all channels for the API key. You can choose to include custom metadata. The example below returns all predefined and custom metadata for all channels:

pubnub.objects.getAllChannelMetadata();

On success, the PubNub SDK returns a paginated list of metadata for all channels.

Remove channel metadata

You can remove all metadata for one channel. The example below removes all metadata for my_channel.

Cascading deletes

When you enable referential integrity on a keyset in the Admin Portal, deleting a channel also deletes its memberships.

If it’s not enabled, deleting a channel won’t delete related memberships.

pubnub.objects.removeChannelMetadata({
channel: "my_channel"
});

On completion, the PubNub SDK will fire the objects -> channel -> delete event so it can be consumed for other clients (users). Refer to Receive Messages to learn more.

Last updated on