Tenant Initiated Notifications

Eclipses allows tenants to send notifications to their customers in the form of SMS, Email and in application push notifications.

SMS and Email Notifications

Email and SMS notifications can be sent to customers using the notifications endpoint.

Eclipse uses the mustache web template system to define the content of the email or SMS. Mustache parameters are passed in the data field in JSON format. Data is bound to the specific mustache template so you need to use the same keys as are used in the template.

e.g. "data": "{"name" : ""Richard"}" will pass in the value "Richard" to be replace key "name" in the mustache template.

For easy sending of custom SMS' there is a pre-existing generic mustache template that allows tenants to send custom messages to customers as follows:

POST /eclipse-conductor/rest/v1/tenants/{tenantId}/notifications
{
	"type": "SMS",
	"data": "{\"data\" : \"SMS content to send\", \"phone\" : \"072381234\"}",
	"templateId": "generic"
}

The permission Notification.CREATE.Allowed needs to be enabled for the user that initiates the request (typically this is the TENANT_SYSTEM user).

SMS Gateways

Eclipse has integrations to Apprentice Valley, AWS and Diamond Trust Bank SMS Gateways. The SMS Gateway to be used is controlled by tenant configs:

  • smsProviderClass - this defines the default SMS Gateway e.g. com.ukheshe.libraries.messaging.sms.SnsSmsProvider
  • smsRoutingConfig - this allows custom SMS gateway routing based on prefix e.g. ^27=com.ukheshe.libraries.messaging.sms.ApprenticeValleySmsProviderV2

In Application Push Notifications

Eclipse can be used to send in app push notifications using the device messages endpoint. Currently Firebase Cloud Messaging (FCM) is supported.

Prerequisites

  • Tenant config messaging.firebase.config needs to be set to the firebase key for the particular mobile application.

Tokens can be registered to a particular customer using the device tokens endpoint:

POST /eclipse-conductor/rest/v1/tenants/{tenantId}/customers/{customerId}/device-tokens    
{
  "tokenType": "FCM",
  "token": "63456345645"
}

And push notifications can be sent to the customer using the device messages endpoint:

POST /eclipse-conductor/rest/v1/tenants/{tenantId}/customers/{customerId}/device-messages 
{
  "deviceMessage": {
    "body": "Test",
    "title": "Test"
  },
  "messageType": "FCM",
  "tokenId": 63456345645
}