We are running a Spring based project with Cognito as the identification service.
We have a project requirement to customise the verification email and invitation email for users in a Cognito user pool. (See here for the AWS doc
)
Default verification message:
Your verification code is {####}.
Default invitation message:
Your username is {username} and temporary password is {####}.
We would like to include the email
, phone_number
and name
user attributes into these emails. Is it possible to do this? I have searched the docs with no avail - and is really in need of some advice.
To update a cognito user's attributes use the admin-update-user-attributes command, specifying the user-pool-id , username and user-attributes parameters.
To customize the email subject and message content for email address verification messages, edit the template under the Do you want to customize your email verification messages? heading. If you choose code as the verification type, your custom message must contain the {####} placeholder.
With a user pool, your app users can sign in through the user pool or federate through a third-party identity provider (IdP). Identity pools are for authorization (access control). You can use identity pools to create unique identities for users and give them access to other AWS services.
Cognito sub attributeWhen creating a user Cognito will assign a generated unique IDs (the sub attribute). This attribute cannot be changed and in case you import users from another pool/backup it will change.
Update: I think the correct way to do this is to use Custom Message
Cognito Lambda trigger (need to implement a function). Then you can have access to all the userAttributes
.
Docs: https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-custom-message.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With