Ext: sg_notifications

sgalinski logo

Repository: https://gitlab.sgalinski.de/typo3/sg_notifications

TYPO3 version: > 9.5

About

Offers a backend module, where editors can manage notifications, to be shown on the website. Additionally, these notifications can be sent as push notifications through the browser. In order for the browser push notifications to work, you have to create a firebase project and configure your API credentials within our website base configurator. The extension also contains two dashboard widgets for the editors.

Notification record structure

NameDescriptionRequiredDefault
titleThe notification's titleNo-
descriptionThe main content of the notification, maximum 1000 character allowed (firebase push notification limitation)Yes-
urlThe URL for the "read more" link in the frontendNo-
layoutDefines which layout to use when showing the notification in the frontend.Nobanner--top
is_activeDefines which notification is shown in the frontend. ONLY one notification per language can be active at a time.NoFALSE
send_push_notificationDefines whether or not this notification should also be send as a push notification.NoFALSE
sendtimeThe time when the push notification should be sent (the scheduler tasks checks this when running).No0
sentReadonly field, which indicates whether this notification was already sent. This field is automatically filled by the scheduler task.NoFALSE
senttimeReadonly field, which indicates when this notification was sent. This field is automatically filled by the scheduler task.No-

Widgets

  • ActiveNotificationWidget: Shows the notification, that is currently active on the website (is_active = 1).
  • LastSentNotificationsWidget: Shows the last X notifications that have been sent.

IMPORTANT: In a multi-domain setup, the widgets will show records from the first domain found, where the user has access to.

Hook

When a notification record is created or updated, a hook is executed, which does two things:

  1. Trigger the email sending, in case the record has is_active = 1 (take a look at the mail template for details about what is actually being sent).
  2. Mark other notification records as inactive. "Other" notifications in this case refer to notifications that are not a translation of the modified record, nor its l10n_parent (in case the modified record is already a translated record).

Configuration

Extension Configuration

The following settings can be accessed from the TYPO3 backend module "Settings":

NameDescriptionRequiredDefault
generalStorageIdHere you can define a PID, which will show up in the backend module next to the siteroots that have been found. It can then be selected in the backend module and can be used for storing the created notifications.No-
sendEmailsOnNotificationUpdateWhen checked, updating a notification triggers sending an email (sg_mail template "notification_change") to the address defined in the mail template "notification_change".NoFALSE
enablePushNotificationFieldsWhen checked, an additional TCA palette, containing push notification (firebase) related fields is shown within the notification record TCA.NoFALSE

Firebase Configuration

The first step is to create a firebase project, see: https://firebase.google.com/docs/web/setup/#create-firebase-project

Once you've done this, you need to add a web app to your project. After adding a web app, firebase will offer you a code snippet, containing all the configuration variables that are needed.

Here you can find more information regarding the various configuration variables: https://firebase.google.com/docs/web/setup/#config-object

When you have sucessfully completed the steps above, you can copy & paste the configuration values from firebase into the website base configurator (website configuration backend module, provided by EXT:project_theme_configurator). You will also find documentation for the different variables in there.