Available Channels
Introduction
The Notification Manager is in charge of sending communications/notifications through the different available notification channels.
Wattyo comes out of the box with the following notification channels:
- SMS
- Certificated Email
It’s important to remark that each channel has different associated costs as they are delivered by external solutions.
However, you can add new Channels to the Notification Manager if you need to use any other one or change the external service to be used.
Sending Notifications
You can send notifications in two different ways:
- a totally custom notification where you can specify the channel, the recipient, etc.
- the managed way, which will apply the wattyo’s out of the box functionality.
Managed Notifications
With these notifications you don’t have to specify the recipient information (phone, email, etc) or even the channel. You will just specify the Contact related to the notification and the Notification Manager will automatically identify the preferred channel and the corresponding delivery information.
NotificationManager.send(NotificationEnvelope env)
Additionally you can also override the preferred channel in case you don’t want to respect it.
NotificationManager.send(NotificationEnvelope env)
In both cases you need to pass a NotificationEnvelope which contains the notification details.
Apart from the Channel/Recipient autodetection, the Managed Notifications will automatically create a Task related to the Parent Record with the notification information, and also linked to the associated Contact.
The configuration for the Managed Notifications is handled in the Custom Metadata Types explained in this documentation.
Managed NotificationEnvelopes
You can use any of the existing constructor to generate your NotificationEnvelope
NotificationEnvelope(String notificationId, Id parentRecordId, ID contactID, String subject, String body)
NotificationEnvelope(String notificationId, Id parentRecordId, ID contactID, String subject, String body, List<ID> contentDocumentIds )
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
notificationId | String | Required | Unique identifier for the notification that will be sent to the delivery system | ax3003293023dsRw |
parentRecordId | Id | Required | Record Id related to the notification. The resulting activity will be related to it | a03322942342seWq |
subject | String | Optional | The notification Subject when applies. For instance for mails. | Welcome mail |
body | String | Required | The notification content | Hello Jon, Welcome to Wattyo |
contentDocumentIds | List |
Optional | The list of document Ids to attach to notification. Usually for mail | {a23zs30202382Ssa} |
Custom Notifications
If you want to send a totally custom Notification with any kind of automated functionality you can use the sendCustom method.
NotificationManager.sendCustom(NotificationEnvelope enve)
In this case the recipient information is not automatically detected, and not Task is created for this activity. The NotificationManager will try to send the notification through the specified channel and details.
Custom NotificationEnvelope
You can create your own NotificationEnvelope and pass it to the sendCustom method.
public with sharing class NotificationEnvelope {
public String notificationId;
public Id contactId;
public String recipient;
public String subject;
public String body;
public String channel;
public List<Id> contentVersionIds;
public String status;
public String templateId;
}
Notification History
When using the managed notifications, at Notification Manager Settings, you can choose how to manage the Notifications History:
- Apex: A class implementing the NotificationHistoryInterface that will receive the just sent notification.
- Flow: A Flow that will receive the notificationEnvelope parameter of type NotificationEnvelope
- Auto: The out-of-the-box historification will be enabled.
- None: No historification will be done.
Out of the box Historification
When using the Auto mode for History Mode, the engine will automatically create a record of the SObject specified in the Notification Manager Setting and will populate it according to the mapping setup in the same custom metadata type.
By default (and the recommended way) the engine stores the history in the Task/Activity object.
Setting Up the Notification Manager
Notification Manager Channels
Here you can define which Channels are available for Notification Sending and who/what is in charge of processing them.
Field | Type | Required | Description | Example |
---|---|---|---|---|
Channel Value | String | Required | The Channel Picklist value associated to this configuration | |
Contact Recipient Field API Name | String | Required | The field api name in Contact that stores the recipient delivery information i.e Email, Phone, etc. | |
Implementation Type | Picklist | Optional | The channel implementation type. | Apex |
Implementation API Name | String | Optional | The Flow or Apex (NotificationChannelInterface) api name. | My_Class |
Task Subtype | Picklist | Optional | In case the History Object is a Task, the desired task subtype associated to this channel | Call |
Notification Manager Setting | Lookup | Optional | If set, it will use the specified Notification Manager Setting instead of the Default one |
Notification Manager SObjects
It defines where to find the Contact Id to get the Contact for the notification.
Field | Type | Required | Description | Example |
---|---|---|---|---|
SObject API Name | String | Required | The SObject to enable for Automated Notifications | |
Contact Field API Name | String | Required | The field api name in the SObject that stores the Contact Look Up/Id to take the delivery information from. | Contact |
Notification Manager Settings
It defines different Notification Manager Settings.
Field | Type | Required | Description | Example |
---|---|---|---|---|
Default Configuration | Boolean | Optional | Check to set the configuration as the default one. There should be only one Default. | true |
History Fields | * | * | It set the historification object and related fields |