For a large number of our customers, the Salesforce Platform serves as the cornerstone of their information systems, and thus it needs to integrate seamlessly with a broad range of third-party systems. Among the many integration options available lies the Salesforce Event Platform.

In this post, we’ll go through a brief refresher on the Event Platform and then explore the new Event Platform and API requests that were added to the Salesforce Platform APIs collection on Postman. You’ll also learn how we introduced the ability to configure Event Relays and custom channels with Postman.

Screenshot of the Event Platform folder in the Salesforce Platform APIs Postman collection

About the Salesforce Event Platform

The Event Platform consists of different features that allow you to build event-driven architectures thanks to the Salesforce Event Bus.

Event types

The Salesforce Event Bus supports two main types of near real-time events: platform events and change events.

Platform events allow communication within the Platform and with external systems. These events can be sent and received with custom code or declarative tools, such as Flow. There are standard platform events with predefined fields and custom events that you can create with custom fields.

Change events are sent automatically by the Platform whenever a record is created, modified, deleted, or undeleted. Each change event is tied to a standard or custom Salesforce object, and event fields match those of its parent object.

Platform events and change events can be sent and received thanks to a choice of two streaming technologies: the legacy CometD library or the more modern gRCP-based Pub/Sub API. Regardless of the technology or the event type, you publish or subscribe to events via dedicated channels.

Architecture diagram showing the Salesforce Event Bus, event channels, and events

Custom channels

You can define a custom channel to group event messages of the same type (platform events or change events) in one stream. For example, you can combine Account, Contact, and Order change events into a single CustomerUpdates__chn custom channel. After subscribing to this channel, you’ll receive notifications about changes to either of those three objects.

Note that custom channels are supported for custom platform events, but not standard platform events.

In addition to the ability to group multiple events, custom channels unlock two features: event filtering and change event enrichment.

Event filtering allows you to configure expressions that filter out events being sent on a custom channel. For example, you could create a specific channel like UkLargeCustomerUpdates__chn that filters account updates, where the billing country is the UK and the annual revenue is greater than 500k. Using event filtering helps to simplify client-side code, but it also helps to avoid the maximum concurrent subscriber limits.

Change Data Capture custom channels also grant the ability to declare enriched fields. When working with change events, only the updated field values are passed in the event data. This optimization can be problematic in certain situations, for instance, when you want to synchronize with a third-party system with an external ID. In this case, the external ID doesn’t change, so it’s never part of the change event data. Thankfully, field enrichment allows you to declare a custom channel in which you can specify fields that will always be passed in the context of change events.

Event Relay

Event Relay allows you to seamlessly integrate Salesforce real-time events with Amazon Web Services (AWS). Thanks to Event Relay, platform events and Change Data Capture events are sent to Amazon EventBridge via channels and can be directly consumed by AWS components. AWS components can also natively publish platform events.

Check out this Event Relay post to learn more.

Architecture diagram showing Event Relay between the Salesforce Event Bus and AWS EventBridge

Before the Summer ’23 release, Event Relay could only be configured via the APIs. Now, there’s a dedicated user interface under Setup. The only piece that you still need to create via Tooling API or Metadata API is custom channels.

Screenshot of the Setup UI for configuring Event Relays

Salesforce Event Platform updates for the Postman collection

In June, we updated the Salesforce Platform APIs collection for Postman to include requests for interacting with the Event Platform. If you’re not familiar with Postman or the Platform APIs collection, take a look at the Quick Start: Connect Postman to Salesforce Trailhead project to get started.

Custom channels

Our new Postman requests are a great time saver since — as of the Summer ’23 release — custom channels can only be configured via Metadata or Tooling API calls and can’t be directly modified in Salesforce Setup.

We’ve introduced a number of requests to perform Create/Read/Update/Delete (CRUD) operations on custom channels and the two related metadata types: PlatformEventChannel(see docs) and PlatformEventChannelMember (see docs).

Entity relationship diagram showcasing PlatformEventChannel and PlatformEventChannelMember metadata types

Despite their names, these metadata types work for both platform events and change events custom channels. The only differences are that the value of the ChannelType attribute must be set to event for platform events or data for change events, and that the EnrichedFields attribute is only available for change event custom channels.

Publish platform events

We’ve added a number of examples for publishing platform events. We moved the existing REST API request to the new Publish Platform Events subfolder, and we added two examples for publishing multiple events in a single request with the Composite API and the SOAP API.

Event Relay configuration

The Event Relay Configuration folder is where most of the new requests are located. These new requests are instrumental to setting up an event relay:

  • CRUD operations on Named Credentials that were introduced in Summer ’23
  • CRUD operations on Event Relay configuration
  • Consulting Event Relay feedback

Event schema

We added two new requests for retrieving the schema of a platform event either from its ID or from its name. These requests are helpful for retrieving the fields of the events.

Screenshot of Postman with a request that retrieves the schema of a platform event

What lies ahead with the Postman collection

We’re continuously investing in our Platform APIs collection and are looking at adding support for Pub Sub API event subscription. CometD won’t be supported as it’s a library that requires an application server, but we are looking at connecting with the gRPC-based Pub/Sub API.

Postman has released a number of features for interacting with gRPC APIs since last year. Thanks to these, we’re able to connect to the Pub/Sub API, subscribe to events, and receive them. However, we’re unfortunately unable to decode their payload as it is compressed by the Salesforce Platform for performance reasons. We’re waiting for a new Postman feature that would allow us to load a library (Apache Avro) for decoding event payloads when they are received.

Screenshot of Postman showing the Pub/Sub API receiving an event with an encoded payload

Closing words

That’s it for our brief overview of the Event Platform and the newest additions to the Salesforce Platform APIs collection. Thanks to growing this toolbox, you’re able to get started quickly when exploring and configuring the Event Platform.

If you enjoy our Postman content, do let us know. You can also take a look at our other open-source collections and contribute.

Resources

About the author

Philippe Ozil is a Principal Developer Advocate at Salesforce where he focuses on the Salesforce Platform. He writes technical content and speaks frequently at conferences. He is a full-stack developer and enjoys working on DevOps, robotics, and VR projects. Follow him on Twitter @PhilippeOzil or check his GitHub projects @pozil.

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS