Custom Message Lambda Parameters
Amazon Cognito invokes this trigger before sending an email or phone verification message or a multi-factor authentication (MFA) code, allowing you to customize the message dynamically. Static custom messages can be edited in the Message Customizations tab of the Amazon Cognito console.
The request includes codeParameter
, which is a string that acts as a
placeholder for the code that's being delivered to the user. Insert the
codeParameter
string into the message body, at the position where
you want the verification code to be inserted. On receiving this response, the Amazon
Cognito
service replaces the codeParameter
string with the actual verification
code.
Note
A custom message Lambda function with the
CustomMessage_AdminCreateUser
trigger returns a user name and
verification code and so the request must include both
request.usernameParameter
and
request.codeParameter
.
"request": { "userAttributes": { "
string
": "string
", .... }, "codeParameter": "string
", "usernameParameter": "string
" // The username parameter is required for the admin create user flow. }
- userAttributes
-
One or more name-value pairs representing user attributes.
- codeParameter
-
A string for you to use as the placeholder for the verification code in the custom message.
- username
-
The username parameter. It is a required request parameter for the admin create user flow.
In the response, you specify the custom text to use in messages to your users.
"response": { "smsMessage": "
string
", "emailMessage": "string
", "emailSubject": "string
"; }
- smsMessage
-
The custom SMS message to be sent to your users. Must include the
codeParameter
value received in the request. - emailMessage
-
The custom email message to be sent to your users. Must include the
codeParameter
value received in the request. - emailSubject
-
The subject line for the custom message.