diff --git a/src/lambda/register_client.js b/src/lambda/register_client.js index 70c3ce7..e97ab93 100644 --- a/src/lambda/register_client.js +++ b/src/lambda/register_client.js @@ -14,7 +14,7 @@ exports.handler = async (event, context) => { } - const body = ` + const registrationBody = `
Please find the Client application registration details below:
@@ -42,30 +42,62 @@ exports.handler = async (event, context) => {Regards, ALA Systems Team
+ ` + + + const confirmationBody = ` +Dear User,
+ +This is an auto-generated response from the Atlas of Living Australia's (ALA) Tokens Application
+ +We'd like to let you know that you Client Application Registration request has been submitted to ALA. Our team will review your request and respond to you as soon as they can.
+ +Regards, + ALA Systems Team + + ala.org.au +
-This email address (${event.resourceOwnerEmail}) included in the CC was provided to us via the ALA Tokens App at tokens.ala.org.au. If you did not submit a request in relation to API access, please email us at support@ala.org.au as soon as possible. +
This email address (${event.resourceOwnerEmail}) was provided to us via the ALA Tokens App at tokens.ala.org.au. If you did not submit a request in relation to API access, please email us at support@ala.org.au as soon as possible.
- ` - const emailParams = { + + // send email from ALA SRC_EMAIL to ALA DEST_EMAIL - this should create a ticket in service desk + const registrationEmailParams = { Destination: { - ToAddresses: [DEST_EMAIL], - CcAddresses: [event.resourceOwnerEmail] + ToAddresses: [DEST_EMAIL] }, Message: { Body: { - Html: { Data: body} + Html: { Data: registrationBody} }, Subject: { Data: "Request for ALA Client Application Registration" }, }, Source: SOURCE_EMAIL, }; + + // send a confirmation email from from the public DEST_EMAIL to requesting user + const confirmationEmailParams = { + Destination: { + ToAddresses: [event.resourceOwnerEmail] + }, + Message: { + Body: { + Html: { Data: confirmationBody} + }, + + Subject: { Data: "Request for ALA Client Application Registration" }, + }, + Source: DEST_EMAIL, + }; try { - const command = new SendEmailCommand(emailParams) - await client.send(command) + const registrationCommand = new SendEmailCommand(registrationEmailParams) + const confirmationCommand = new SendEmailCommand(confirmationEmailParams) + await client.send(registrationCommand) + await client.send(confirmationCommand) return { statusCode: 200, body: "Request submitted successfully!"