Add a Change Event in a New Channel Member

To add a change event to the channel that you created, add a channel member.

Required Editions

User Permissions Needed
To create a PlatformEventChannel: Customize Application

Prerequisites:

Change events are predefined by Salesforce so you don’t define them. To learn about Salesforce objects that support change events, see Change Event Object Support in the Change Data Capture Developer Guide.

  1. Send a POST request to this URI.
    /services/data/v65.0/tooling/sobjects/PlatformEventChannelMember
  2. If you’re using Postman, expand Event Platform | Custom Channels | Platform Event, and click Create channel member.
  3. Specify the channel in the eventChannel field and the event in the selectedEntity field. This example references a change event, AccountChangeEvent. Use this example request body. In Postman, click Body, and replace the body with this JSON body.
    {
      "FullName": "Account_Channel_chn_AccountChangeEvent",
      "Metadata": {
        "eventChannel": "Account_Channel__chn",
        "selectedEntity": "AccountChangeEvent"
      }
    }
  4. Send the request. The response received looks similar to this response.
    {
      "id": "0v8RM0000000GHCYA2",
      "success": true,
      "errors": [],
      "warnings": [],
      "infos": []
    }

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