Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cognito Customise Messages and Include User Attributes

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.

like image 388
kukkuz Avatar asked Jan 27 '17 10:01

kukkuz


People also ask

How do I change user attributes in Cognito?

To update a cognito user's attributes use the admin-update-user-attributes command, specifying the user-pool-id , username and user-attributes parameters.

How do I customize my verification email on Amazon Cognito?

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.

What is the main difference between Cognito user pool and Cognito identity pool?

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.

What is sub attribute in Cognito?

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.


1 Answers

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

like image 73
Shal Avatar answered Sep 27 '22 01:09

Shal