const attendees = [
{ name: 'Alice Johnson', email: 'alice@example.com', ticketId: 'TK001' },
{ name: 'Bob Smith', email: 'bob@example.com', ticketId: 'TK002' },
// ... more attendees
];
const batch = await pictify.templates.batchRender('tmpl_certificate', {
variableSets: attendees.map(a => ({
recipientName: a.name,
eventName: 'Tech Conference 2026',
eventDate: 'January 29, 2026',
certificateId: `CERT-${a.ticketId}`
})),
format: 'png',
webhookUrl: `${process.env.BASE_URL}/webhooks/certificates`
});
// After batch completes, send emails
async function sendCertificates(batchId: string) {
const results = await pictify.templates.getBatchResults(batchId);
for (const result of results.results) {
const attendee = attendees[result.index];
await sendEmail({
to: attendee.email,
subject: 'Your Conference Certificate',
body: `Download your certificate: ${result.url}`
});
}
}