I am working on a function that generates the content for an email body, to be used in either a notification effect from an automation or in a notification effect for an action. Platform documentation outlines the process for a “Notification Builder” function, but I wasn’t sure if an automation (or action) function-generated email body could also just take in an HTML string? When I wrote a version of the function below, the function doesn’t populate as an option to select. It is published to master branch and tagged.
Hi @kelseylt , only functions that output the Notification type (docs) can be used. However, you can use HTML as the content of the email notification, e.g.:
Is there some nuance to what html Foundry expects? I have the below function but the html isn’t being used to format the email.
@Function()
public async createPmTaskNotification(pmTask: PmTask): Promise<Notification> {
// Define the email body
const body = `
Hello!
<br>
<br>
You have been assigned a new task. in the project: NA.
<br>
<br>
<b><u>Task Name:</b></u> NA
<br>
<b><u>Task Description:</b></u> NA
<br>
<b><u>project:</b></u> NA
`;
// Create a short notification that will be shown within the platform
const shortNotification = ShortNotification.builder()
.heading(`New Task in project: NA.`)
.content(body)
.addObjectLink("View Task", NA)
.build();
// Create Email Notification Content
const emailNotificationContent = EmailNotificationContent.builder()
.subject(`New Task in Project:NA`)
.body(body)
.addObjectLink("View Task", NA)
.build();
return Notification.builder()
.shortNotification(shortNotification)
.emailNotificationContent(emailNotificationContent)
.build();
}```