Get #Buildspiration with Custom Notifications in Summer ’19

Get your #buildspiration from the Summer ’19 release! We are sharing five of our favorite release features for Developers (and Admins) as part of the The MOAR You Know learning journey. Get the release highlights as curated and published by our evangelists. Complete the trailmix by July 31, 2019, to get a special community badge, and unlock a contribution of $10 to FIRST.

In Summer ’19 we introduce a new way to make notifications work for you, on both desktop and mobile. Custom notifications allow you to send important information to your users via push to mobile or desktop alerts. Here we will discuss how you can fully customize the notifications to inform users of record information, changes, and updates. Custom notifications will bring relevant information to your users at the right time!

How do I get started?

You’ll need to start by creating a Custom Notification Type in Setup. This is a new option in Summer ’19 that allows us to define the notification to be sent. When you create the notification you’ll want to make sure to check the supported channels for the notification.

Once you’ve created the Custom Notification Type, you can trigger the notification in one of two ways: Process Builder or via the REST API.

Send notification in Process Builder

When defining actions in Process Builder, you will notice a new option: Send Custom Notification.

Once you select that option, you can fill in all of your information about the notification you want to send. In my case, I wanted my process builder to let a Case Owner’s manager know when a High Priority case is closed. This is so much better than posting to Chatter and tagging that person!

Send notification via the REST API

If you want to send a request via the REST API, the first step is to get the ID of the notification you want to send. The easiest way to do this is the query for it using the Tooling API. I used:

SELECT id,customNotifTypeName FROM CustomNotificationType

With my ID in hand, I can continue to form my REST API call with the Title and Body of the notification I want to send. My end Custom Notification looked like this:

curl --include --request POST \
--header "Authorization: Authorization: Bearer 00DR...xyz" \
--header "Content-Type: application/json" \
--data '{ "inputs" :
  [
  {
    "customNotifTypeId" : "0ML1k0000008OIFGA2",
    "recipientIds" : ["0051k000001G0f5AAC"],
    "title" : "Case Closed!",
    "body" : "Your High Priority Case has been Closed.",
    "targetId" : "5001k00000BrdQ9AAJ"
  }
  ]
}' \
"https://gs0.salesforce.com/services/data/v46.0/actions/standard/customNotificationAction"

You’ll notice my request was a bit different this time, just letting the user know when any cases they owned were closed, but you can start to see that with any idea, you can send a custom notification from almost anywhere!

Further reading

Now that you’ve seen how easy it is to get started with custom notifications, check out the rest of our documentation and get hands on today!

Leave your comments...

Get #Buildspiration with Custom Notifications in Summer ’19