Send Custom Notifications from Apex
Where: This change applies to Enterprise, Performance, Unlimited, and Developer editions.
Why: Rather than make API callouts from Apex, use CustomNotification to send notifications. It requires fewer lines of code, and avoids API callout and authentication complexity. It’s also more efficient, which is especially helpful when you’re sending notifications from triggers, or sending many notifications.
How: Using the Messaging.CustomNotification class to create and send custom notifications from Apex is easy. Create a new instance of CustomNotification, configure a few notification details, and call the send() method.