- Newest
- Most votes
- Most comments
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
Relevant content
- asked 5 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago