Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create admin API endpoint(s) for sending out emails #2184

Open
yarikoptic opened this issue Feb 12, 2025 · 0 comments
Open

Create admin API endpoint(s) for sending out emails #2184

yarikoptic opened this issue Feb 12, 2025 · 0 comments
Labels
DX Affects developer experience

Comments

@yarikoptic
Copy link
Member

yarikoptic commented Feb 12, 2025

We already are sending some emails e.g. when notifying users during registration.

DB has email information for dandiset owners and contacts, and all registered users of the archive.

I think it would make total sense to centralize ability to email DANDI users by use via API, so we could potentially use it in services outside of the dandi-archive, e.g. for admins

there could potentially be use cases even for authenticated users, although not immediately needed

  • dandi-cli reportbug {dandiset_id} (does not exist but could)

So having endpoint(s) allowing for those above would have been nice IMHO. It could potentially also take care about proper re-formatting of markdown message text into html and txt versions, adding "branded" header/footnotes and other conveniences.

We could have per dandiset endpoint /dandisets/{dandiset__pk}/contact and then /users/contact with data fields like

  • content
  • content-encoding (for markdown vs txt vs html)
  • subject
  • from

Related

Current functionality which does emailing

❯ git grep 'def send_'
dandiapi/api/mail.py:def send_ownership_change_emails(dandiset, removed_owners, added_owners):
dandiapi/api/mail.py:def send_registered_notice_email(user: User, socialaccount: SocialAccount):
dandiapi/api/mail.py:def send_new_user_message_email(user: User, socialaccount: SocialAccount):
dandiapi/api/mail.py:def send_approved_user_message(user: User, socialaccount: SocialAccount):
dandiapi/api/mail.py:def send_rejected_user_message(user: User, socialaccount: SocialAccount):
dandiapi/api/mail.py:def send_pending_users_message(users: Iterable[User]):
dandiapi/api/mail.py:def send_dandiset_unembargoed_message(dandiset: Dandiset):
dandiapi/api/mail.py:def send_dandiset_unembargo_failed_message(dandiset: Dandiset):
dandiapi/api/tasks/scheduled.py:def send_pending_users_email() -> None:

so the skeleton is already there in https://github.com/dandi/dandi-archive/blob/HEAD/dandiapi/api/mail.py and there is already the build_message() to serve as a starting point!

@yarikoptic yarikoptic added the DX Affects developer experience label Feb 12, 2025
@yarikoptic yarikoptic changed the title Create admin API endpoint(s) for emailing specific Create admin API endpoint(s) for sending out emails Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Affects developer experience
Projects
None yet
Development

No branches or pull requests

1 participant