API Docs for: 2.6
Show:

notification_manager Class

Provides the notification manager functionalities.

Methods

config

(
  • path
)

Configures the module by using the specified JSON configuration file.

Parameters:

  • path String

    The path of the JSON configuration file

extractNewPostitMostRecent

(
  • list
)
Object private

Returns the most recent post-it from the list.

Parameters:

  • list Array

    The list of all unread post-it messages of a user

Returns:

Object:

The most recent post-it.

extractNewVoicemailMostRecent

(
  • list
)
Object private

Returns the most recent voicemail from the list.

Parameters:

  • list Array

    The list of all new voice messages of a voicemail

Returns:

Object:

The most recent voicemail.

getPostitNotificationEmailBody

(
  • creator
  • recipient
  • list
)
String private

Returns the body of the email message used to notify new post-it messages.

Parameters:

  • creator String

    The creator username of the new post-it message

  • recipient String

    The recipient username of the new post-it message

  • list Array

    The list of all unread post-it of the recipient user

Returns:

String:

The body of the email message.

getPostitNotificationEmailSubject

(
  • creator
  • recipient
  • list
)
String private

Returns the subject of the email message used to notify new post-it messages.

Parameters:

  • creator String

    The creator username of the new post-it message

  • recipient String

    The recipient username of the new post-it message

  • list Array

    The list of all unread post-it of the recipient user

Returns:

String:

The subject of the email message.

getPostitNotificationSmsBody

(
  • creator
  • recipient
  • list
)
String private

Returns the body of the sms message used to notify new post-it message.

Parameters:

  • creator String

    The creator username of the new post-it message

  • recipient String

    The recipient username of the new post-it message

  • list Array

    The list of all unread post-it of the recipient user

Returns:

String:

The body of the sms message.

getVmNotificationEmailBody

(
  • username
  • voicemail
  • list
)
String private

Returns the body of the email message used to notify new voice messages.

Parameters:

  • username String

    The username identifier

  • voicemail String

    The voicemail identifier

  • list Array

    The list of all new voice messages of the voicemail

Returns:

String:

The body of the email message.

getVmNotificationEmailSubject

(
  • username
  • voicemail
  • list
)
String private

Returns the subject of the email message used to notify new voice messages.

Parameters:

  • username String

    The username identifier

  • voicemail String

    The voicemail identifier

  • list Array

    The list of all new voice messages of the voicemail

Returns:

String:

The subject of the email message.

getVmNotificationSmsBody

(
  • username
  • voicemail
  • list
)
String private

Returns the body of the sms message used to notify new voice messages.

Parameters:

  • username String

    The username identifier

  • voicemail String

    The voicemail identifier

  • list Array

    The list of all new voice messages of the voicemail

Returns:

String:

The body of the sms message.

initEjsTemplates

() private

Initializes the ejs templates used to send notifications. The default templates are in the DEFAULT_TEMPLATES_DIR but the templates present in customTemplatesPath are more priority.

newPostitListener

(
  • creator
  • recipient
  • list
)
private

Manages the new post-it event emitted by the postit component. It sends the post-it notifications to the recipient user of the post-it using their notification configurations.

Parameters:

  • creator String

    The creator username of the new post-it

  • recipient String

    The recipient username of the new post-it

  • list Array

    The list of all unread post-it of the recipient user

newVoiceMessageListener

(
  • voicemail
  • list
)
private

Manages the new voicemail event emitted by the voicemail component. It sends the voicemail notifications to all users who use the voicemail using their notification configurations.

Parameters:

  • voicemail String

    The voicemail identifier

  • list Array

    The list of all new voicemail messages

sendNewPostitNotificationEmail

(
  • creator
  • recipient
  • list
  • cb
)
private

Sends a new post-it notification to the user by email.

Parameters:

  • creator String

    The creator username of the new post-it message

  • recipient String

    The recipient username of the new post-it message

  • list Array

    The list of all unread post-it of the recipient user

  • cb Function

    The callback function

sendNewPostitNotificationEmailCb

(
  • err
  • resp
)
private

The callback function of the send notification of a new post-it message by email. It's called at the end of the email dispatch.

Parameters:

  • err Object

    The error object

  • resp Object

    The response of the action

sendNewPostitNotificationMobile

(
  • recipient
  • cb
)
private

Sends a post-it notification to the mobile apps of the user.

Parameters:

  • recipient String

    The recipient username of the new post-it message

  • cb Function

    The callback function

sendNewPostitNotificationMobileCb

(
  • err
  • resp
)
private

The callback function of the send notification of a new post-it message to mobile apps. It's called at the end of the mobile app dispatch.

Parameters:

  • err Object

    The error object

  • resp Object

    The response of the action

sendNewPostitNotificationSms

(
  • creator
  • recipient
  • list
  • cb
)
private

Sends a post-it notification to the user by sms.

Parameters:

  • creator String

    The creator username of the new post-it message

  • recipient String

    The recipient username of the new post-it message

  • list Array

    The list of all unread post-it of the recipient user

  • cb Function

    The callback function

sendNewPostitNotificationSmsCb

(
  • err
  • resp
)
private

The callback function of the send notification of a new post-it message by sms. It's called at the end of the sms dispatch.

Parameters:

  • err Object

    The error object

  • resp Object

    The response of the action

sendNewVoicemailNotificationEmail

(
  • username
  • voicemail
  • list
  • cb
)
private

Sends a voicemail notification to the user by email.

Parameters:

  • username String

    The user identifier

  • voicemail String

    The voicemail identifier

  • list Array

    The list of all new voice messages of the voicemail

  • cb Function

    The callback function

sendNewVoicemailNotificationEmailCb

(
  • err
  • resp
)
private

The callback function of the send notification of a new voicemail message by email. It's called at the end of the email dispatch.

Parameters:

  • err Object

    The error object

  • resp Object

    The response of the action

sendNewVoicemailNotificationSms

(
  • username
  • voicemail
  • list
  • cb
)
private

Sends a voicemail notification to the user by sms.

Parameters:

  • username String

    The user identifier

  • voicemail String

    The voicemail identifier

  • list Array

    The list of all new voice messages of the voicemail

  • cb Function

    The callback function

sendNewVoicemailNotificationSmsCb

(
  • err
  • resp
)
private

The callback function of the send notification of a new voicemail message by sms. It's called at the end of the sms dispatch.

Parameters:

  • err Object

    The error object

  • resp Object

    The response of the action

setCompAuthorization

(
  • comp
)
static

Set the authorization architect component.

Parameters:

  • comp Object

    The architect authorization component

setCompConfigManager

(
  • comp
)

Set configuration manager architect component used by configuration functions.

Parameters:

  • comp Object

    The configuration manager architect component.

setCompMailer

(
  • comp
)

Sets the mailer architect component.

Parameters:

  • comp Object

    The mailer architect component.

setCompMobile

(
  • comp
)

Sets the mobile architect component.

Parameters:

  • comp Object

    The mobile architect component.

setCompPostit

(
  • comp
)

Sets the postit architect component used by postit functions.

Parameters:

  • comp Object

    The postit architect component.

setCompSms

(
  • comp
)

Sets the sms architect component.

Parameters:

  • comp Object

    The sms architect component.

setCompUser

(
  • comp
)

Set user architect component used for user functions.

Parameters:

  • comp Object

    The user architect component.

setCompVoicemail

(
  • comp
)

Set voicemail architect component used by voicemail functions.

Parameters:

  • comp Object

    The voicemail architect component.

setLogger

(
  • log
)
static

Set the logger to be used.

Parameters:

  • log Object

    The logger object. It must have at least three methods: info, warn and error as console object.

setPostitListeners

() private

Sets the event listeners for the postit component.

setVoicemailListeners

() private

Sets the event listeners for the voicemail component.

start

()

Creates the server websocket.

Properties

compAuthorization

Object private

The architect component to be used for authorization.

compConfigManager

Object private

The configuration manager architect component used for configuration functions.

compMailer

Object private

The architect component to be used for mailer functions.

compMobile

Object private

The mobile architect component used for mobile functions.

compPostit

Object private

The postit architect component used for postit functions.

compSms

Object private

The architect component to be used for sms functions.

compUser

Object private

The architect component to be used for user functions.

compVoicemail

Object private

The voicemail architect component used for voicemail functions.

customTemplatesPath

String private

The directory path of the custom templates used by the notification manager. All templates in this path are more priority than the default ones.

DEFAULT_TEMPLATES_DIR

String private final

The default directory of the notification templates.

Default: "templates/locales/it"

EJS_TEMPLATE_FILENAMES

Object private final

The file name of all the ejs templates.

Default: { newPostitSmsBody: "new_postit_sms_body.ejs", newPostitEmailBody: "new_postit_email_body.ejs", newVoicemailSmsBody: "new_voicemail_sms_body.ejs", newVoicemailEmailBody: "new_voicemail_email_body.ejs", newPostitEmailSubject: "new_postit_email_subject.ejs", newVoicemailEmailSubject: "new_voicemail_email_subject.ejs" }

ejsTemplates

Object private

All the ejs templates used for the notifications. The keys are the name of the file and the values are their content.

IDLOG

String private final

The module identifier used by the logger.

Default: [notification_manager]

logger

Object private

The logger. It must have at least three methods: info, warn and error.

Default: console