Skip to content

Commit

Permalink
Add usernameParameter to CognitoEventUserPoolsCustomMessageRequest (#219
Browse files Browse the repository at this point in the history
)

The CustomMessage_AdminCreateUser trigger returns a user name and verification code, so the request must include both request.usernameParameter and request.codeParameter. Add the usernameParameter field to the CognitoEventUserPoolsCustomMessageRequest struct to meet this requirement.

https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-custom-message.html
  • Loading branch information
andrewmostello authored and bmoffatt committed Aug 19, 2019
1 parent 19047df commit cb30add
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions events/cognito.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,9 @@ type CognitoEventUserPoolsCustomMessage struct {

// CognitoEventUserPoolsCustomMessageRequest contains the request portion of a CustomMessage event
type CognitoEventUserPoolsCustomMessageRequest struct {
UserAttributes map[string]interface{} `json:"userAttributes"`
CodeParameter string `json:"codeParameter"`
UserAttributes map[string]interface{} `json:"userAttributes"`
CodeParameter string `json:"codeParameter"`
UsernameParameter string `json:"usernameParameter"`
}

// CognitoEventUserPoolsCustomMessageResponse contains the response portion of a CustomMessage event
Expand Down
3 changes: 2 additions & 1 deletion events/testdata/cognito-event-userpools-custommessage.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"phone_number_verified": true,
"email_verified": false
},
"codeParameter": "####"
"codeParameter": "####",
"usernameParameter": "{username}"
},
"response": {
"smsMessage": "<custom message to be sent in the message with code parameter>",
Expand Down

0 comments on commit cb30add

Please sign in to comment.