How do I get Cognito user pool information from lambda (python)?

Asked 1 years ago, Updated 1 years ago, 379 views

We are considering sending mail only to users who have specified attributes among users registered with awscognito.
The user pool was accessible and user information could not be retrieved, but the value specified for the custom attribute could not be retrieved.

response=client.list_users(
  UserPoolId = USER_POOL_ID,
  AttributesToGet=['email',
  Limit = LIMIT
)

We are trying to decide whether or not to send an email based on the data of the custom attributes, so we are having trouble meeting the requirements.I'm thinking of using a user group instead of a custom attribute, but I don't know how to retrieve it in the same way. (I looked it up on the web, but I couldn't find it because I didn't get many references.)
If you know how to get custom attributes or user groups from lambda(python), please let me know.If you have information that you can't do it, that's fine.
Thank you for your cooperation.

aws lambda

2022-12-14 03:52

1 Answers

If you want to check Cognito's API specifications, the API documentation is more helpful than the SDK documentation.

https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_ListUsers.html

Questioning

Unable to retrieve the specified value for the custom attribute

For , you can either specify the corresponding custom attributes in AttributesToGet or remove the AttributesToGet designation itself.If not specified, all attributes are returned.With this API, you have to list the previous users, so I think it would be more efficient if you put the ListUsersInGroup API after putting the users in the group.


2022-12-14 05:46

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.