Content Moderation Notifications

Sends email notifications to users when content transitions between moderation states via Drupal's Content Moderation module.

content_moderation_notifications
9,488 sites
63
drupal.org

Install

Drupal 11, 10, 9 v8.x-3.8
composer require 'drupal/content_moderation_notifications:8.x-3.8'
Drupal 8 v8.x-3.4
composer require 'drupal/content_moderation_notifications:8.x-3.4'

Overview

The Content Moderation Notifications module extends Drupal's core Content Moderation functionality by enabling automated email notifications when content undergoes workflow state transitions. This is essential for editorial workflows where team members need to be informed about content status changes.

The module allows site administrators to create multiple notification rules, each targeting specific workflow transitions. Notifications can be sent to users with specific roles (with access verification), the content author, custom email addresses, or users referenced in entity reference fields. The module supports Twig templating in the email subject, body, and adhoc email fields, providing powerful customization options including conditional logic and access to entity fields.

All recipients except adhoc emails are checked for access permissions before sending, ensuring that users only receive notifications for content they can view. Emails are sent using BCC headers to protect recipient privacy, with the site email optionally included as the primary recipient.

Features

  • Create multiple notification rules for different workflow transitions
  • Send notifications to all users with specified roles (with entity view access verification)
  • Send notifications to the content author
  • Send notifications to custom/adhoc email addresses
  • Send notifications to users referenced in entity reference fields on the content
  • Twig templating support in email subject, body, and adhoc email addresses fields
  • Token replacement support in email content (enhanced when Token module is installed)
  • Enable/disable individual notifications without deleting them
  • Access to entity and user context variables in Twig templates (entity title, bundle, owner info, current user info)
  • Text format selection for email body content
  • Supports all Content Moderation workflows defined in Drupal core
  • BCC-based email delivery for recipient privacy
  • Skip notifications during entity synchronization (e.g., migrations)
  • Alter hook for customizing notification data before sending

Use Cases

Editorial Review Workflow Notifications

Configure notifications to alert editors when content is submitted for review. Create a notification for the 'Submit for Review' transition, assign editor roles as recipients, and include entity details like title, author, and direct link to the content in the email body using Twig variables.

Author Notification on Publication

Notify content authors when their content has been published. Create a notification for the 'Publish' transition, enable the 'Email the author' option, and compose a congratulatory message that includes the published URL using Twig templating.

Department-Specific Notifications

Send notifications to department managers referenced in a content field. Add a user entity reference field (e.g., field_department_manager) to your content type, then select this field in the 'Entity Reference User Fields' section. Managers will automatically receive notifications for their department's content transitions.

Dynamic Recipient Lists via Twig

Use Twig templating in the Adhoc email addresses field to dynamically determine recipients based on content field values. For example, access a referenced entity's email field: {{ entity.field_department.entity.field_manager_email.0.value }}

Conditional Email Content

Use Twig conditionals in the email body to customize messages based on content properties. For example, add special instructions for urgent content or include different information based on the content type.

Multi-Step Approval Workflow

Create separate notifications for each step in a complex approval workflow. Configure distinct notifications for Draft to Review, Review to Legal, Legal to Final Approval, and Final Approval to Published transitions, each targeting the appropriate team members.

Tips

  • Use the Token module to easily browse and insert available tokens in your notification templates
  • When sending to roles, only users who can view the content will receive notifications - this prevents information leakage
  • The site email address is used as the primary recipient by default. Check 'Disable the site email address' if you want notifications sent only to BCC recipients
  • Twig variables available include: entity (the content), user (current user), plus shorthand properties like entity.title, entity.bundle, entity.owner.email
  • Combine Twig conditionals with entity fields to create dynamic, context-aware notification content
  • Test notifications in a development environment before deploying to production to ensure templates render correctly
  • Notifications are not sent during migrations or when entities are syncing - this is intentional to prevent notification floods

Technical Details

Admin Pages 6
Content Moderation Notifications /admin/config/workflow/notifications

Lists all configured content moderation notifications in a tabular format. Each row displays the notification label, associated workflow, status (enabled/disabled), transitions that trigger it, roles that receive it, whether the author is emailed, and any adhoc email addresses. Provides operations to edit, delete, enable, or disable each notification.

Add notification /admin/config/workflow/notifications/add

Form to create a new content moderation notification rule. Configure which workflow transitions trigger the notification, who should receive it, and compose the email content with optional Twig templating.

Edit notification /admin/config/workflow/notifications/manage/{content_moderation_notification}

Form to modify an existing content moderation notification rule. All fields from the add form are available for editing.

Delete notification /admin/config/workflow/notifications/manage/{content_moderation_notification}/delete

Confirmation form to permanently delete a content moderation notification rule.

Enable notification /admin/config/workflow/notifications/manage/{content_moderation_notification}/enable

Confirmation form to enable a disabled notification rule. Once enabled, emails will be sent when the configured transitions occur.

Disable notification /admin/config/workflow/notifications/manage/{content_moderation_notification}/disable

Confirmation form to disable an active notification rule. Disabled notifications will not send emails until re-enabled.

Permissions 1
Administer content moderation notifications

Create, edit, delete, enable, and disable content moderation notification rules. Users with this permission can access the notifications administration interface.

Hooks 1
hook_content_moderation_notification_mail_data_alter

Allows modules to alter the mail data before a notification is sent. This hook is invoked after all recipients have been gathered and before the email is dispatched.

Security Notes 4
  • Adhoc email addresses do not undergo access checking - use with caution and only include trusted addresses
  • Role-based recipients are verified for entity view access before receiving notifications
  • Emails are sent via BCC to protect recipient privacy and prevent reply-all issues
  • The module respects Drupal's text format security - choose appropriate formats for email body content