Create a Custom Channel and Add Platform Events with Tooling API

Create a channel for orders named Order_Channel__chn, and add two platform events as members: Order_NorthAmer__e and Order_EMEA__e.

User Permissions Needed
To create or update PlatformEventChannel and PlatformEventChannelMember objects: Customize Application
To use REST API: API Enabled

You can use your preferred REST API tool to perform these steps. We recommend using Postman with the Salesforce Platform APIs collection, which contains handy templates for Salesforce API calls. See Quick Start: Connect Postman to Salesforce in Trailhead.

  1. Create the channel using PlatformEventChannel, and set the channelType field to event. Send a POST request to this URI.
    /services/data/v63.0/tooling/sobjects/PlatformEventChannel

    If you're using Postman, expand Event Platform | Custom Channels | Platform Event, and then click Create channel.

  2. Use this request body.
    {
      "FullName": "Order_Channel__chn",
      "Metadata": {
        "channelType": "event",
        "label": "Custom Channel for Orders"
      }
    }
    You receive a response similar to this response.
    {
        "id": "0YLRM0000004CEI4A2",
        "success": true,
        "errors": [],
        "warnings": [],
        "infos": []
    }
  3. Add the Order_NorthAmer__e platform event to the channel using PlatformEventChannelMember. The channel member references the channel it’s part of (Order_Channel__chn) through the eventChannel field. Specify the platform event in the selectedEntity field. Send a POST request to this URI.
    /services/data/v63.0/tooling/sobjects/PlatformEventChannelMember

    If you're using Postman, expand Event Platform | Custom Channels | Platform Event, and then click Create channel member.

  4. Use this request body.
    {
     "FullName": "Order_Channel_chn_Order_NorthAmer_e",
     "Metadata": {
      "eventChannel": "Order_Channel__chn",
      "selectedEntity": "Order_NorthAmer__e"
     }
    }
    You receive a response similar to this response.
    {
        "id": "0v8RM0000000N6uYAE",
        "success": true,
        "errors": [],
        "warnings": [],
        "infos": []
    }
  5. Add the second channel member that specifies the platform event, Order_EMEA__e. Send a POST request to this URI.
    /services/data/v63.0/tooling/sobjects/PlatformEventChannelMember

    If you're using Postman, expand Event Platform | Custom Channels | Platform Event, and then click Create channel member.

  6. Use this request body.
    {
     "FullName": "Order_Channel_chn_Order_EMEA_e",
     "Metadata": {
      "eventChannel": "Order_Channel__chn",
      "selectedEntity": "Order_EMEA__e"
     }
    }
    You receive a response similar to this response.
    {
        "id": "0v8RM0000004VPJYA2",
        "success": true,
        "errors": [],
        "warnings": [],
        "infos": []
    }