Create a Channel Member to Associate the Custom Platform Event

To add an event to the channel that you just created, add a channel member. Specify the channel in the eventChannel field and the event in the selectedEntity field. This example references a custom platform event, Carbon_Comparison__e.

USER PERMISSIONS NEEDED
To create a PlatformEventChannelMember:Customize Application
To use REST API:API Enabled
  1. Send a POST request to this URI:

    /services/data/v56.0/tooling/sobjects/PlatformEventChannelMember

  2. If you're using Postman, under Tooling, click Post Tooling SObject, and then replace the :SOBJECT_API_NAME placeholder with PlatformEventChannelMember.

  3. Use this example request body:

  4. Send the request. The response received looks similar to the following.

A channel (PlatformEventChannel) can have multiple channel members (PlatformEventChannelMember), which means that you can add multiple platform events to a channel. This example adds only one platform event, Carbon_Comparison__e. To add another event to the channel, create another PlatformEventChannelMember.

For more information, see PlatformEventChannelMember in the Tooling API Developer Guide.

This example is based on a custom platform event. You can also set up a change data capture channel and members. Set the channelType field for a change data capture channel to data. An example of a PlatformEventChannel and PlatformEventChannelMember definition in JSON is provided for Tooling API request bodies.

This PlatformEventChannel defines the change data capture channel with full name MyRelayChangeEventChannel__chn.

This PlatformEventChannelMember adds AccountChangeEvent as a member to the channel.

For more information, see Compose Streams of Change Data Capture Notifications with Custom Channels in the Change Data Capture Developer Guide.