HyphaApp / hypha

Submission management software for open calls
http://docs.hypha.app/
BSD 3-Clause "New" or "Revised" License
69 stars 38 forks source link

Custom determination message templating #2657

Closed chriszs closed 2 years ago

chriszs commented 2 years ago

This is a little more of a discussion, because I'm not sure the way I've approached it is something the project will want to adopt, but here goes anyway:

Is your feature request related to a problem? Please describe.

ARDC wants to have templated values from application answers in their determination messages, specifically they want to have things like the dollar amount, the applicant's address and so forth. They want a bunch of boiler plate to vary depending on determination. And they'd like it if they could review that before it's sent.

Is your feature request related to an existing functionality? Please describe.

This is related to sending determination messages.

Describe the solution you'd like

Here's what I did: I made it so the determination messages set in the Wagtail CMS can include template values. They get processed by the templating system, replacing question strings (e.g. {{address}}) with answers. That way, when the staff member sending a determination gets to that screen there's a pre-populated message. This is a little bit of a non-standard approach because it involves applying templating to a user-supplied message, but the users in this case are admins or highly privileged, so it feels low-risk.

Describe alternatives you've considered

We could keep it so the only templating happens in template files and then the only customization of determination boilerplate would be a source code change and the only part the staff member could provide would be a custom message which slots into the boiler plate. This seems to be sort of how it was designed originally, but with the addition of the question form fields as template-able values and with a way to vary the boiler plate depending on the outcome.

Additional context

Screen Shot 2021-11-19 at 4 15 04 PM

The above shows the result of the templating.

Priority

Affected roles

Ideal deadline

Near term for our version, longer term for core/upstream.

kfogel commented 2 years ago

I know my "+1" here only partly counts, because I'm representing the same organization as @chriszs :-), but I think the ability to review (and thus possibly edit) the about-to-be-sent message before sending will be important to many users.

Often the user will wish to insert a personal sentence or two into the message, for example because they have been communicating with the applicant out-of-band and thus know particular things about the applicant and/or their application. There's a big difference between the custom sentence being a field (that slots into the boilerplate in a particular place) and having the ability to edit the message as "full text" before sending -- the latter is better.

frjo commented 2 years ago

I'm hesitant on two issues:

  1. The determination message is sent via e-mail. I consider e-mail an insecure channel. Much like a postcard. Not a channel I like to send any sensitive information.
  2. Having staff users enter/edit "{{variables}}" is fragile. I believe it is too much of a load to put on the user.

How do you view these two issues?

fourthletter commented 2 years ago

I'm a proponent of pre-populated messages that are editable. A majority of our determination templates are approximately 1-2 paragraphs long. There was a nascent idea of using meta terms to group/segment applications, and associate these applications with the appropriate message. For example:

chriszs commented 2 years ago

Re: your questions, @frjo:

  1. I think the information we're talking about is not particularly sensitive and the convenience of including it in the message outweighs that. A postcard is a good metaphor, but I don't know that users trying to tell an applicant their project was accepted think of it that way.
  2. Yes, I think this is an issue. I did look at the feasibility of extending Draftail to include template blocks last night. It seems doable, but would be somewhat more involved.
chriszs commented 2 years ago

After talking it over with Karl, I think in the long term it might be a good idea to give users more control over message template language, but in the short term we're solving this using almost-existing tools (with one slight addition). In the interest of not adding to the backlog, I plan to close this for now and may open a narrower one for that change. Thanks for your thoughts!

fourthletter commented 2 years ago

I need the phrase "In the interest of not adding to the backlog, I plan to close this for now" hand stitched on a pillow 🪡