How can I send email / start the lambda function when registering a new user?
In the "Change identifier pool" section, I found only a synchronization trigger. If I understand correctly: this works every time the user synchronizes his data ...
Is there a way to call the lambda function only for "initial" synchronization or when a specific user data set is created for the user?

Edit:
To be more specific: I create a user through lambdas using the JS SDK. I use developer authentication with my own oauth2 thread. I do not know how to distinguish between the user providing access, for example. via Google for the first time from someone doing it a second time. Json with a passcode seam to me ... Maybe I'm wrong.
Also, using the call getOpenIdTokenForDeveloperIdentity, I don’t know how to distinguish an identifier that is new to cognito from one already known cognito.
Edit 2: To be even more precise: I built this project: https://github.com/laardee/serverless-authentication-boilerplate/blob/master/authentication/lib/storage/usersStorage.js
.
, nth time. , , ...
const saveCognito = (profile) => new Promise((resolve, reject) => {
if (profile) {
cognitoidentity.getOpenIdTokenForDeveloperIdentity({
IdentityPoolId: process.env.COGNITO_IDENTITY_POOL_ID,
Logins: {
[process.env.COGNITO_PROVIDER_NAME]: profile.userId
}
}, (err, dat) => {
if (err) {
reject(err);
} else {
var list_params = {
DatasetName: 'user-data',
IdentityId: dat.IdentityId,
IdentityPoolId: process.env.COGNITO_IDENTITY_POOL_ID
};
cognitosync.listRecords(list_params, function(err, data) {
if (err) {
reject(err);
} else {
var RecordPatches =
list_params["SyncSessionToken"] = data.SyncSessionToken;
list_params["RecordPatches"] = RecordPatches;
cognitosync.updateRecords(list_params, function(err, update_data) {
if (err){
reject(err);
} else {
resolve();
}
});
}
});
}
});
} else {
reject('Invalid profile');
}
});