Other Ways to Send a Custom Notification

We’ve made it easy to build notifications using clicks, not code. But if your business needs are more complex, we also support flows and programmatic solutions.

Tip
Tip To see how to specify the target using JSON, see pageReference.

Flow Builder

Flow Core Action: Send Custom Notification: The Send Custom Notification action is available in Flow Builder. Add it to your flow, then add recipients and content.

Some tips specific to custom notifications:

  • To query for the Notification Type ID directly from a flow, add the Get Record element to your flow and filter by API name. If you’ve installed a notification type via a managed package, filter by the namespace prefix as well as the API name.
  • To add recipients, define Recipient ID as a resource. Then add values to your Recipient ID collection by adding the Assignment element to your flow.

If you’re new to creating flows, learn even more in Flow Reference.

Apex

CustomNotification: Use the CustomNotification Apex class to create, configure, and send custom notifications from Apex code, such as a trigger.

When possible, create and send custom notifications from Apex rather than via API call. It’s less code, and more efficient.

API

CustomNotificationType: Use the CustomNotificationType object to create notification types and query for your Custom Notification Type ID. It’s available for the following APIs:

customNotificationAction Invocable Action: Use the customNotificationAction action to send custom notifications to desktop and delivery channels.