summaryrefslogtreecommitdiffstats
path: root/controller-server/src/main
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@vespa.ai>2023-10-30 10:39:20 +0100
committerBjørn Christian Seime <bjorncs@vespa.ai>2023-10-30 10:39:20 +0100
commitf61444b7c981a8ecb2c131ad1a5f8bcd2de5ebfd (patch)
tree1e6ab8a674cf5ee4a6310a316480ca33aebe9eed /controller-server/src/main
parent9f6d2a9b446fa88e17a2842c9b3b5a1b4ae60d1d (diff)
Move trial notification emails to separate templates
Diffstat (limited to 'controller-server/src/main')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirer.java34
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/MailTemplating.java4
-rw-r--r--controller-server/src/main/resources/mail/cloud-trial-notification.vm3
-rw-r--r--controller-server/src/main/resources/mail/trial-expired.vm3
-rw-r--r--controller-server/src/main/resources/mail/trial-expires-immediately.vm3
-rw-r--r--controller-server/src/main/resources/mail/trial-expires-soon.vm3
-rw-r--r--controller-server/src/main/resources/mail/trial-midway-checkin.vm3
-rw-r--r--controller-server/src/main/resources/mail/trial-signed-up.vm3
8 files changed, 34 insertions, 22 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirer.java
index 55428e80493..27830e755b2 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirer.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirer.java
@@ -95,6 +95,15 @@ public class CloudTrialExpirer extends ControllerMaintainer {
return tombstoneTenants(idleOldPlanTenants);
}
+
+ /*
+ * Trial plan notification states. Transition to a new state triggers a notification/email
+ * - SIGNED_UP: Tenant has signed up for trial
+ * - MID_CHECK_IN: Tenant is halfway through trial (7 days)
+ * - EXPIRES_SOON: Tenant has 2 days left of trial
+ * - EXPIRES_IMMEDIATELY: Tenant has 1 day left of trial
+ * - EXPIRED: Tenant has expired
+ */
private boolean notifyTenants() {
try {
var currentStatus = controller().curator().readTrialNotifications()
@@ -152,44 +161,33 @@ public class CloudTrialExpirer extends ControllerMaintainer {
private void notifySignup(Tenant tenant) {
var consoleMsg = "Welcome to Vespa Cloud trial! [Manage plan](%s)".formatted(billingUrl(tenant));
- queueNotification(tenant, consoleMsg, "Welcome to Vespa Cloud",
- "Welcome to Vespa Cloud! We hope you will enjoy your trial. " +
- "Please reach out to us if you have any questions or feedback.");
+ queueNotification(tenant, consoleMsg, "Welcome to Vespa Cloud", MailTemplating.Template.TRIAL_SIGNED_UP);
}
private void notifyMidCheckIn(Tenant tenant) {
var consoleMsg = "You're halfway through the **14 day** trial period. [Manage plan](%s)".formatted(billingUrl(tenant));
- queueNotification(tenant, consoleMsg, "How is your Vespa Cloud trial going?",
- "How is your Vespa Cloud trial going? " +
- "Please reach out to us if you have any questions or feedback.");
+ queueNotification(tenant, consoleMsg, "How is your Vespa Cloud trial going?", MailTemplating.Template.TRIAL_MIDWAY_CHECKIN);
}
private void notifyExpiresSoon(Tenant tenant) {
var consoleMsg = "Your Vespa Cloud trial expires in **2** days. [Manage plan](%s)".formatted(billingUrl(tenant));
- queueNotification(tenant, consoleMsg, "Your Vespa Cloud trial expires in 2 days",
- "Your Vespa Cloud trial expires in 2 days. " +
- "Please reach out to us if you have any questions or feedback.");
+ queueNotification(tenant, consoleMsg, "Your Vespa Cloud trial expires in 2 days", MailTemplating.Template.TRIAL_EXPIRES_SOON);
}
private void notifyExpiresImmediately(Tenant tenant) {
var consoleMsg = "Your Vespa Cloud trial expires **tomorrow**. [Manage plan](%s)".formatted(billingUrl(tenant));
- queueNotification(tenant, consoleMsg, "Your Vespa Cloud trial expires tomorrow",
- "Your Vespa Cloud trial expires tomorrow. " +
- "Please reach out to us if you have any questions or feedback.");
+ queueNotification(tenant, consoleMsg, "Your Vespa Cloud trial expires tomorrow", MailTemplating.Template.TRIAL_EXPIRES_IMMEDIATELY);
}
private void notifyExpired(Tenant tenant) {
var consoleMsg = "Your Vespa Cloud trial has expired. [Upgrade plan](%s)".formatted(billingUrl(tenant));
- queueNotification(tenant, consoleMsg, "Your Vespa Cloud trial has expired",
- "Your Vespa Cloud trial has expired. " +
- "Please reach out to us if you have any questions or feedback.");
+ queueNotification(tenant, consoleMsg, "Your Vespa Cloud trial has expired", MailTemplating.Template.TRIAL_EXPIRED);
}
- private void queueNotification(Tenant tenant, String consoleMsg, String emailSubject, String emailMsg) {
+ private void queueNotification(Tenant tenant, String consoleMsg, String emailSubject, MailTemplating.Template template) {
var mail = Optional.of(Notification.MailContent.fromTemplate(MailTemplating.Template.DEFAULT_MAIL_CONTENT)
.subject(emailSubject)
- .with("mailMessageTemplate", "cloud-trial-notification")
- .with("cloudTrialMessage", emailMsg)
+ .with("mailMessageTemplate", template.getId())
.with("mailTitle", emailSubject)
.with("consoleLink", controller().serviceRegistry().consoleUrls().tenantOverview(tenant.name()))
.build());
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/MailTemplating.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/MailTemplating.java
index 1c05330702e..0581284e39b 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/MailTemplating.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/MailTemplating.java
@@ -25,7 +25,9 @@ public class MailTemplating {
public enum Template {
MAIL("mail"), DEFAULT_MAIL_CONTENT("default-mail-content"), NOTIFICATION_MESSAGE("notification-message"),
- CLOUD_TRIAL_NOTIFICATION("cloud-trial-notification"), MAIL_VERIFICATION("mail-verification");
+ MAIL_VERIFICATION("mail-verification"), TRIAL_SIGNED_UP("trial-signed-up"), TRIAL_MIDWAY_CHECKIN("trial-midway-checkin"),
+ TRIAL_EXPIRES_SOON("trial-expires-soon"), TRIAL_EXPIRES_IMMEDIATELY("trial-expires-immediately"), TRIAL_EXPIRED("trial-expired")
+ ;
public static Optional<Template> fromId(String id) {
return Arrays.stream(values()).filter(t -> t.id.equals(id)).findAny();
diff --git a/controller-server/src/main/resources/mail/cloud-trial-notification.vm b/controller-server/src/main/resources/mail/cloud-trial-notification.vm
deleted file mode 100644
index c1ba394bf8e..00000000000
--- a/controller-server/src/main/resources/mail/cloud-trial-notification.vm
+++ /dev/null
@@ -1,3 +0,0 @@
-<p>
- $esc.html($cloudTrialMessage)
-</p> \ No newline at end of file
diff --git a/controller-server/src/main/resources/mail/trial-expired.vm b/controller-server/src/main/resources/mail/trial-expired.vm
new file mode 100644
index 00000000000..02d2aacd117
--- /dev/null
+++ b/controller-server/src/main/resources/mail/trial-expired.vm
@@ -0,0 +1,3 @@
+<p>
+ Your Vespa Cloud trial has expired. Please reach out to us if you have any questions or feedback.
+</p> \ No newline at end of file
diff --git a/controller-server/src/main/resources/mail/trial-expires-immediately.vm b/controller-server/src/main/resources/mail/trial-expires-immediately.vm
new file mode 100644
index 00000000000..79604cae2e5
--- /dev/null
+++ b/controller-server/src/main/resources/mail/trial-expires-immediately.vm
@@ -0,0 +1,3 @@
+<p>
+ Your Vespa Cloud trial expires tomorrow. Please reach out to us if you have any questions or feedback.
+</p> \ No newline at end of file
diff --git a/controller-server/src/main/resources/mail/trial-expires-soon.vm b/controller-server/src/main/resources/mail/trial-expires-soon.vm
new file mode 100644
index 00000000000..b1e04ea8969
--- /dev/null
+++ b/controller-server/src/main/resources/mail/trial-expires-soon.vm
@@ -0,0 +1,3 @@
+<p>
+ Your Vespa Cloud trial expires in 2 days. Please reach out to us if you have any questions or feedback.
+</p> \ No newline at end of file
diff --git a/controller-server/src/main/resources/mail/trial-midway-checkin.vm b/controller-server/src/main/resources/mail/trial-midway-checkin.vm
new file mode 100644
index 00000000000..c29c2763ef1
--- /dev/null
+++ b/controller-server/src/main/resources/mail/trial-midway-checkin.vm
@@ -0,0 +1,3 @@
+<p>
+ How is your Vespa Cloud trial going? Please reach out to us if you have any questions or feedback.
+</p> \ No newline at end of file
diff --git a/controller-server/src/main/resources/mail/trial-signed-up.vm b/controller-server/src/main/resources/mail/trial-signed-up.vm
new file mode 100644
index 00000000000..20f1867b7bc
--- /dev/null
+++ b/controller-server/src/main/resources/mail/trial-signed-up.vm
@@ -0,0 +1,3 @@
+<p>
+ Welcome to Vespa Cloud! We hope you will enjoy your trial. Please reach out to us if you have any questions or feedback.
+</p> \ No newline at end of file