Skip to content

feat: add create template method#569

Merged
CarolinaMoraes merged 10 commits intopreview-templatesfrom
feature/product-399-add-create-method
Aug 19, 2025
Merged

feat: add create template method#569
CarolinaMoraes merged 10 commits intopreview-templatesfrom
feature/product-399-add-create-method

Conversation

@CarolinaMoraes
Copy link
Contributor

Description

This PR implements the method for template creation.
Worth mentioning that: besides HTML, it also supports React, as mentioned in the RFC

To support our current template syntax, and avoid users from ending up with a broken React code, the new.email approach to interpolations will be used (this approach was suggested here)

Which means the code (for someone that will use React) will look something like the following:

Template code

<Heading className="text-[24px] font-bold text-gray-900 mb-[16px]">
   Welcome to Your New Beginning, {props.employeeName}
</Heading>

SDK call in a node environment

        const template = await resend.templates.create({
            name: "Welcome to Lumon",
            subject: "Welcome to Lumon Industries - Your journey begins now",
            react: React.createElement(LumonWelcomeEmail, {
                employeeName: "{{{employeeName}}}",
            }),
            variables: [
                { key: "employeeName", type: "string", fallback_value: "Mark S." },
            ]
        })

@CarolinaMoraes CarolinaMoraes self-assigned this Aug 19, 2025
@CarolinaMoraes CarolinaMoraes requested a review from a team as a code owner August 19, 2025 14:28
@CarolinaMoraes CarolinaMoraes requested review from felipevolpone and removed request for a team August 19, 2025 14:28
@CarolinaMoraes CarolinaMoraes merged commit 732c319 into preview-templates Aug 19, 2025
6 checks passed
@CarolinaMoraes CarolinaMoraes deleted the feature/product-399-add-create-method branch August 19, 2025 19:20
CarolinaMoraes added a commit that referenced this pull request Aug 25, 2025
CarolinaMoraes added a commit that referenced this pull request Sep 29, 2025
CarolinaMoraes added a commit that referenced this pull request Sep 29, 2025
CarolinaMoraes added a commit that referenced this pull request Sep 29, 2025
CarolinaMoraes added a commit that referenced this pull request Sep 29, 2025
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