To add a platform event to the channel that you created, create a channel member.
Required Editions
| User Permissions Needed | |
|---|---|
| To create a PlatformEventChannel: | Customize Application |
Prerequisites:
- Create a Channel for a Custom Platform Event
- Define the Carbon_Comparison__e platform event in (Optional) Define a Platform Event for this channel member.
-
Send a POST request to this URI.
/services/data/v65.0/tooling/sobjects/PlatformEventChannelMember - If you’re using Postman, expand Event Platform | Custom Channels | Platform Event, and click Create channel member.
-
Specify the channel in the
eventChannelfield and the event in theselectedEntityfield. This example references a custom platform event,Carbon_Comparison__e. Use this example request body. In Postman, click Body, and replace the body with this JSON body.{ "FullName": "Carbon_Comparison_Channel_chn_Carbon_Comparison_e", "Metadata": { "eventChannel": "Carbon_Comparison_Channel__chn", "selectedEntity": "Carbon_Comparison__e" } } -
Send the request. The response received looks similar to this response.
{ "id": "0v8RM0000000G3iYAE", "success": true, "errors": [], "warnings": [], "infos": [] }
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.