// Create template
import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
await resend.templates.create({
name: 'order-confirmation',
from: 'Resend Store <store@resend.com>',
subject: 'Thanks for your order!',
html: "<p>Name: {{{PRODUCT}}}</p><p>Total: {{{PRICE}}}</p>",
variables: [
{
key: 'PRODUCT',
type: 'string',
fallbackValue: 'item'
},
{
key: 'PRICE',
type: 'number',
fallbackValue: 20
}
]
});
// Publish template
await resend.templates.publish('template_id');
// Or create and publish a template in one step
await resend.templates.create({ ... }).publish();