Skip to content

Commit 5e794cf

Browse files
committed
add an optional call to action button for email notifications
1 parent 56921d4 commit 5e794cf

File tree

4 files changed

+37
-3
lines changed

4 files changed

+37
-3
lines changed

src/api/routes/roomRequests.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ const roomRequestRoutes: FastifyPluginAsync = async (fastify, _options) => {
139139
payload: {
140140
to: [originalRequestor],
141141
subject: "Room Reservation Request Status Change",
142-
content: `Your Room Reservation Request has been been moved to status "${formatStatus(request.body.status)}". Please visit ${fastify.environmentConfig.UserFacingUrl}/roomRequests/${semesterId}/${requestId} to view details.`,
142+
content: `Your Room Reservation Request has been been moved to status "${formatStatus(request.body.status)}". Please visit the management portal for more details.`,
143+
callToActionButton: {
144+
name: "View Room Request",
145+
url: `${fastify.environmentConfig.UserFacingUrl}/roomRequests/${semesterId}/${requestId}`,
146+
},
143147
},
144148
};
145149
if (!fastify.sqsClient) {
@@ -353,7 +357,11 @@ const roomRequestRoutes: FastifyPluginAsync = async (fastify, _options) => {
353357
payload: {
354358
to: [notificationRecipients[fastify.runEnvironment].OfficerBoard],
355359
subject: "New Room Reservation Request",
356-
content: `A new room reservation request has been created (${request.body.host} | ${request.body.title}). Please visit ${fastify.environmentConfig.UserFacingUrl}/roomRequests/${request.body.semester}/${requestId} to view details.`,
360+
content: `A new room reservation request has been created (${request.body.host} | ${request.body.title}). Please visit the management portal for more details.`,
361+
callToActionButton: {
362+
name: "View Room Request",
363+
url: `${fastify.environmentConfig.UserFacingUrl}/roomRequests/${request.body.semester}/${requestId}`,
364+
},
357365
},
358366
};
359367
if (!fastify.sqsClient) {

src/api/routes/stripe.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
StripeLinkCreateParams,
1818
} from "api/functions/stripe.js";
1919
import { getSecretValue } from "api/plugins/auth.js";
20-
import { genericConfig } from "common/config.js";
20+
import { environmentConfig, genericConfig } from "common/config.js";
2121
import {
2222
BaseError,
2323
DatabaseFetchError,
@@ -408,6 +408,10 @@ const stripeRoutes: FastifyPluginAsync = async (fastify, _options) => {
408408
to: [unmarshalledEntry.userId],
409409
subject: `Payment Recieved for Invoice ${unmarshalledEntry.invoiceId}`,
410410
content: `ACM @ UIUC has received ${paidInFull ? "full" : "partial"} payment for Invoice ${unmarshalledEntry.invoiceId} (${withCurrency} by ${name}, ${email}).\n\nPlease contact Officer Board with any questions.`,
411+
callToActionButton: {
412+
name: "View Your Stripe Links",
413+
url: `${fastify.environmentConfig.UserFacingUrl}/stripe`,
414+
},
411415
},
412416
};
413417
if (!fastify.sqsClient) {

src/api/sqs/handlers/templates/notification.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,24 @@ const template = /*html*/ `
3333
<tr>
3434
<td style="padding: 30px;"> {{nl2br content}} </td>
3535
</tr>
36+
37+
{{#if callToActionButton}}
38+
<tr>
39+
<td align="center" style="padding: 0 30px 30px 30px;">
40+
<table border="0" cellspacing="0" cellpadding="0">
41+
<tr>
42+
<td align="center" style="border-radius: 5px;" bgcolor="#5386E4">
43+
<a href="{{callToActionButton.url}}" target="_blank"
44+
style="font-size: 16px; font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, sans-serif; font-weight: bold; color: #ffffff; text-decoration: none; border-radius: 5px; padding: 12px 25px; border: 1px solid #5386E4; display: inline-block;">
45+
{{callToActionButton.name}}
46+
</a>
47+
</td>
48+
</tr>
49+
</table>
50+
</td>
51+
</tr>
52+
{{/if}}
53+
3654
<tr>
3755
<td align="center" style="padding-bottom: 30px;">
3856
<p style="font-size: 12px; color: #888; text-align: center;"> <a href="https://acm.illinois.edu"

src/common/types/sqsMessage.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ export const sqsPayloadSchemas = {
6363
bcc: z.optional(z.array(z.string().email()).min(1)),
6464
subject: z.string().min(1),
6565
content: z.string().min(1),
66+
callToActionButton: z.object({
67+
name: z.string().min(1),
68+
url: z.string().min(1).url()
69+
}).optional()
6670
})
6771
)
6872
} as const;

0 commit comments

Comments
 (0)