tobira icon indicating copy to clipboard operation
tobira copied to clipboard

E-Mail notifications once an upload is complete

Open LukasKalbertodt opened this issue 2 years ago • 1 comments

This is a feature requested by the ETH. It is unclear which part of the whole software stack should be responsible for this. I think Opencast should do E-Mail notifications. Tobira does currently not have an email for users and has also no capabilities to send mails. That would add quite a bit of complexity to it all.

However, we are not done with it by saying "ok Opencast should do it". How does Opencast get the user E-Mail? The upload is done via a temporary JWT user. Opencast could look up a mail address for a specific username, but uff. Or Tobira does need to know about E-Mails? And what if we want a checkbox in Tobira for users to select whether they want e-mail notifications? Lots of open questions.

LukasKalbertodt avatar Jan 19 '23 14:01 LukasKalbertodt

Alternatively, an information should be provided in Tobira.

oas777 avatar Jun 14 '23 12:06 oas777

So I looked into this and could get my local Opencast + Tobira setup to send myself an email at the end of a workflow, targeting the email address of my Tobira user, (ab-)using the elan mail server.

So yes, this is already possible, with just Opencast configuration.

The way I was doing it relied upon the username Tobira tells Opencast being unique, as it is used to look up the email address internally. If we don't want that, there are a few rather easy changes one could apply to Opencast and/or Tobira to remove that requirement. Before we investigate further into those, we should talk about it, though. /cc @dagraf, @oas777.

What follows is a rather technical description of the process for the purposes of documentation.


First of all, Opencast needs to be able to send email. Everything one needs to know is in the file etc/org.opencastproject.kernel.mail.SmtpService.cfg. But yeah, that means you need access to some SMTP server somewhere.

With that, it's as simple as adding a workflow operation to whatever workflow the uploader triggers, probably somewhere near the end. The docs for the appropriate workflow operation handler are surprisingly thorough, and FWIW here is my very basic test:

    <operation id="send-email">
      <configurations>
        <configuration key="to">${workflow.creatorName}</configuration>
        <configuration key="subject">${mediaPackage.title} has been published</configuration>
      </configurations>
    </operation>

The one thing I didn't get from the docs but from reading the code is the fact that addresses (to, cc, etc.) are "parsed." That is, the code splits them at ,, checks whether they are valid email addresses, and if they are not, interprets them as usernames and tries to look up any address Opencast might have stored for any user with that name.

JulianKniephoff avatar Oct 28 '24 12:10 JulianKniephoff

FWIW, Tobira already requires auth solutions to provide unique usernames: https://elan-ev.github.io/tobira/setup/auth/user#user-information-tobira-needs

Though the docs are a bit underspecified... it might be unique in Tobira, but when Opencast uses other sources of usernames as well, things could clash.

LukasKalbertodt avatar Oct 28 '24 12:10 LukasKalbertodt

Thanks, Julian. Don't forget to adapt the feedback text the user sees:

"Ihr Video wurde erfolgreich hochgeladen und wird nun verarbeitet; Sie erhalten eine Benachrichtigung per E-Mail, sobald das Video zur Verfügung steht. Sie können diese Seite jetzt schließen." "Your video was uploaded successfully and is now being processed; you will receive an e-mail once processing is done and the video is available. You may close this page now."

oas777 avatar Oct 28 '24 13:10 oas777

That's a good point, but one we should talk about as well: Tobira can't know and/or rely on the fact that the connected Opencast will actually send a mail in the relevant workflow, right now. 🤔

JulianKniephoff avatar Oct 28 '24 13:10 JulianKniephoff

Reminder to close this.

oas777 avatar Nov 20 '24 18:11 oas777

So yes, the ETH successfully configured their workflows to send email notifications. This is helped by #1268.

The text might still be changed in the future, but that's not the highest priority and we are waiting for other changes (like #556 and #444).

LukasKalbertodt avatar Nov 21 '24 11:11 LukasKalbertodt