Skip to content

Update custom magic link functions to accept user attributes#241

Merged
ottokruse merged 3 commits intoaws-samples:mainfrom
RobHarveyDev:pass-extra-data-for-magic-links
Apr 7, 2025
Merged

Update custom magic link functions to accept user attributes#241
ottokruse merged 3 commits intoaws-samples:mainfrom
RobHarveyDev:pass-extra-data-for-magic-links

Conversation

@RobHarveyDev
Copy link
Contributor

Issue #, if available: N/A

Description of changes:
Updates the createEmailContent and sendEmailWithLink to accept the user attributes from cognito as additional parameters.

This is to allow customising the email content and sending based on the users details, such as branding.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ottokruse
Copy link
Contributor

Nice!

Nitpick/QQ, this looks slightly brittle:

import { StringMap } from "aws-lambda/trigger/cognito-user-pool-trigger/_common";

Is that not available as top level import, or maybe we can extract it with a Parameters<> trick, or even have a Record<str, ?what?>

@ottokruse
Copy link
Contributor

And run prettier please :)

@RobHarveyDev
Copy link
Contributor Author

RobHarveyDev commented Apr 2, 2025

Nice!

Nitpick/QQ, this looks slightly brittle:

import { StringMap } from "aws-lambda/trigger/cognito-user-pool-trigger/_common";

Is that not available as top level import, or maybe we can extract it with a Parameters<> trick, or even have a Record<str, ?what?>

Not that I can see. I can change it to be

userAttributes: { [name: string]: string };

instead to avoid the import

@ottokruse
Copy link
Contributor

Not that I can see. I can change it to be

userAttributes: { [name: string]: string };

instead to avoid the import

I like that

@RobHarveyDev
Copy link
Contributor Author

Is this ok to be merged?

@ottokruse ottokruse merged commit 8ab4ff5 into aws-samples:main Apr 7, 2025
1 check passed
@ottokruse
Copy link
Contributor

ottokruse commented Apr 7, 2025

Yes thank you.
Need to publish to NPM still, bare with me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants