In
#3215938: Data stream email notifications β
we are implementing notifications as a data_stream_notification
config entity that is configured with both condition
and delivery
plugins. In that issue we will add an initial email
delivery plugin. I'm opening this as a separate feature request because it is not required to get parity with farmOS 1.x, but seems like a logical next step! Also note that this *could potentially* require some update hooks to update email notifications to a new "format" if is implemented after the 2.x beta release.
Initially I'm keeping this quite simple - the only "configuration" provided to the plugin is an array of email addresses. The email subject and body are hard coded to show the data stream w/ a link, the actual value received, and a list of the conditions that were met. This is equivalent to the email we construct in farmOS 2.x: https://github.com/farmOS/farmOS/blob/722339943b4ab30587eb0795249f0e1d28...
But now that we will have a UI to configure data stream notifications, the email subject and body could easily be exposed to the user as part of the configuration as well. This could allow for much more customization of what a notification message actually includes and provide more custom links to act/view on the outcome. Ideally this same concept could be used by other delivery plugins that want to allow customization of the "message" they're sending.
Fundamentally this just requires some way of allowing the delivery plugin to "embed" data from the notification context into parts of the email subject/body. It seems logical to implement this using the existing Drupal token replacement system: https://www.drupal.org/documentation/modules/token β
Right now these emails are hard-coded using the "context" that is set on the email delivery plugin - but this same context is available to any other delivery plugin, too! So ideally all available "context" from the notifications could be added to a new "data stream notification" token group. It seems like the token module even provides some form/render elements for displaying the available tokens in the UI.
Perhaps something to consider is that this could complicate the UI quite a bit. Maybe this option would be hidden by default, and shown once a "Specify custom email format" is clicked. This could also help solve the update/migration issue.
N/A
Use the existing Drupal convention of token replacement
Implement
Allow customizing of email message with tokens.
Only additions, potentially provide some low level helper methods for replacing notification tokens, but this might not be required.
Email plugins would need additional "subject" and "body" fields to store custom message formats.
Active
3.0
Miscellaneous
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.