sendNotification

Sends a notification email to a specified email address.

Configuration

This function type accepts the following parameters:

KeyTypeDefaultDescription
to *stringThe recipient's email address

Example

{
"functions": {
"sendEmail": {
"type": "sendNotification",
"to": "{your-email-address}"
}
}
}

Arguments

This function type accepts the following client-side arguments when called:

KeyTypeDefaultDescription
subject *stringThe email subject line
replyTostringThe Reply-To address
fieldsobject{}An object of data to include in the email body

Example

import { createClient, sendEmail } from '@statickit/functions';
let client = createClient({ site: '{your-site-id}' });
let { status } = await sendEmail(client, {
subject: "You've got mail!",
replyTo: "[email protected]",
fields: {
first_name: "Jane",
message: "I think you're cool!"
}
});

When called, this function will send a plain-text HTML email to the configured to address with the subject line You've got mail!:

first_name:
Jane
message:
I think you're cool!
Sent from StaticKit

Response

Returns a status and no additional properties.