AWS cognito custom signup message without verification code

0

Hi,

I am building a authentication system where the user can show their interest by registering. However, upon signup, instead of sending verification code, I want to send the user a Thank you message and somebody from the internal team will reach to them to evaluate their eligibility for the program before proceeding with the registration. How can I achieve this. I want the user to be in unverified state unless someone from the team confirms their eligibility. In simple words, I want to send the user a Thank you mail without verification code in the custom signup message.

Thanks

1 Answer
0

To customize the sign-up message in AWS Cognito without including a verification code, you can use a Lambda trigger to intercept the message sending process and customize the content. The CustomMessage_SignUp trigger allows you to define a custom message that is sent post-registration. Normally, this message includes a codeParameter placeholder, which is replaced by Cognito with the actual verification code. However, you can simply omit this placeholder from the custom message if you do not wish to include a verification code.

Here's an example of how you might modify the Lambda function to send only a thank you message:

exports.handler = async (event) => {
  if (event.triggerSource === "CustomMessage_SignUp") {
    // Custom message without the verification code
    const thankYouMessage = "Thank you for registering your interest. Our team will reach out to you shortly.";

    // Assign custom message to the email message response
    event.response.emailMessage = thankYouMessage;
    event.response.emailSubject = "Thank you for your interest";
    
    // Omitting the SMS message since you might not need to send a text
  }
  return event;
};

In this script, the codeParameter is not included in the thankYouMessage string, so no verification code will be sent. The user will remain unverified until a team member manually verifies them.

When you deploy this Lambda function, make sure to associate it with the CustomMessage_SignUp trigger in your user pool settings. Also, test the function thoroughly to ensure it behaves as expected, especially considering the custom workflow you're implementing for user verification.

https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-custom-message.html

AWS
Drew D
answered 5 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions