Skip to content

colorfield/message_group_notify

Repository files navigation

Message Group Notify

Drupal 8 module that sends Messages on entity creation or update to groups. Group types are configurable as internal or external set of contacts (example: Drupal Role, Drupal Group, Mailchimp List, CiviCRM Group).

What’s the difference with Message Notify?

It actually relies on Message Notify for the send operation. The main difference is the group registration process.

Subscription scope is per content type and per group. Notification process happens per content type (automatically) or per content (manually, by the content editor).

It provides a UI for the following features

  • group type configuration
  • content type configuration
  • send a node to a group
  • view the messages that were sent for a node For other features see the use case diagram below.

Users can then manage content subscription preferences locally (see roadmap). Users can unsubscribe globally to a group (e.g. Mailchimp mailing list, Group).

-Message Group Notify entities

Primary use case

Notifications can be sent to groups in two ways.

  • Per content type, groups are receiving message notifications for each selected operation (create, update, delete) on the nodes from this content type.
  • Per node, the content editor sends messages to groups manually.

For content types only on the first release.

Messages can be sent through a channel (example: website block, mail, PWA notification, ...). Mail relay is configurable per Group type (example: Drupal mail, Swiftmailer, Mailchimp/Mandrill, CiviCRM CiviMail, ...).

Secondary use case: Message digest

Configurable and reviewable weekly digest: is sent on demand with possible group override. Messages can be included in the weekly digest on the entity create/edit form.

Configuration

System wide

On /admin/config/message/message_group_notify

  • Group types, current options are Role, Group, Mailchimp, CiviCRM.
  • Optional status message, on success and on failure.
  • Test email

Per content type

  • Send mode per node (default) or per content type. You can enable per content or per content type group notify settings. If per content is selected, messages will be sent on demand, per node. If per content type is selected, messages will be sent automatically for the selected operations.
  • Operations limits the message notification to create, update or delete operations.
  • Groups limits the message notification to the selected groups.
  • Channels limits the message notification to mail channel, other channels to be added.

Message view modes of Email

  • After enabling the module, head to 'Structure > Message templates > Manage display'.
  • On the 'Notify - Email body' tab : set the Field e.g. to 'Node reference' and Format to 'Rendered entity'.
  • On the 'Notify - Email subject' : set the Field e.g. to 'Node reference' and Format to 'Label (No link)'.
  • Create or edit an entity and check your mail.

-Message Group Notify - Email body

Note that if you are using HTML for the 'Email body', you should install a module like Mime Mail or Swift Mailer.

The following configuration has been tested:

  • Mime Mail
  • Configure it on /admin/config/system/mailsystem with Mime Mail mailer as formatter and Default PHP mailer as sender (to preserve the from email that can be defined via Message Notify).

Mail templates

There are several options, here is an approach.

  • Define a 'Mail' view mode for content in /admin/structure/display-modes/view.
  • Activate this view mode for the content types that are the subject of notification message (e.g. /admin/structure/types/manage/article/display).
  • Set the desired field per content type (e.g. /admin/structure/types/manage/article/display/mail).
  • Configure then this view mode for the 'Notify - Email body' Message view mode (/admin/structure/message/manage/group_notify_node/display/mail_body).

A default theme implementation based on Zurb is on its way, you can still provide your own theme implementation with one of this template:

message--group-notify-node--mail-body.html.twig
message--group-notify-node.html.twig
message--mail-body.html.twig
message.html.twig

Message templates

Optionally, edit the Message template with tokens or text to customize the messages that will be listed on /admin/content/messages and /node/{node_id}/message_group_notify.

Roadmap

Currently under active development, here are the key topics.

  • Create MessageGroup and MessageContact content entities and MessageGroupType config entity.
  • Enable a content type for group notification, so it can marked as eligible for user notification preferences.
  • Remove content types from notification preferences that are not visible by a group (e.g. via Role, Group, …).
  • Add user notification preferences per content type.
  • Add user notification preferences per frequency (directly, weekly).
  • Make use of Message Subscribe to flag content types.
  • Add digest feature, using Message Digest.

See the use case diagram.

Related modules

About

Drupal 8 module that sends Messages on entity creation or update to Groups.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published