Recipe: course certificate
Goal: when a learner completes a course on your platform, a personalized certificate is generated and emailed to them.
You’ll use: serif fonts, default values, the export API from a webhook handler.
1. Design the certificate
Section titled “1. Design the certificate”-
Create a template named
Certificate of completion. -
Frame — a large rectangle with a transparent fill, a 6 px stroke in a muted gold (
#b08d57), corner radius 24. Add a second, thinner dashed rectangle inside it for an engraved look. -
Heading —
Certificate of Completionin Crimson Text, 72 px, centered. -
Body — in Merriweather 32 px:
This certifies that
participantNamehas successfully completedcourseTitleoncompletionDate.Set
participantNamein bold 56 px so it stands out. -
Signature area — a thin rectangle as a line, with
instructorNameunderneath. -
Configure the variables:
Variable Required Default participantName✅ courseTitle✅ completionDate✅ instructorNameThe Academy TeamcertificateId
2. Generate it on completion
Section titled “2. Generate it on completion”A typical webhook handler (Express here) — generate, then email:
app.post('/webhooks/course-completed', async (req, res) => { const { learner, course, completedAt, enrollmentId } = req.body;
const pdf = await fetch( `https://app.imprime.io/api/export/${process.env.CERTIFICATE_TEMPLATE_ID}/pdf`, { method: 'POST', headers: { 'x-api-key': process.env.IMPRIME_API_KEY!, 'Content-Type': 'application/json', }, body: JSON.stringify({ participantName: `${learner.firstName} ${learner.lastName}`, courseTitle: course.title, completionDate: new Date(completedAt).toLocaleDateString('en-US', { dateStyle: 'long' }), certificateId: `CERT-${enrollmentId}`, // instructorName omitted → "The Academy Team" }), }, );
if (!pdf.ok) return res.status(502).json({ error: await pdf.text() });
await mailer.send({ to: learner.email, subject: `Your certificate for ${course.title}`, attachments: [ { filename: 'certificate.pdf', content: Buffer.from(await pdf.arrayBuffer()) }, ], });
res.sendStatus(204);});3. Variations
Section titled “3. Variations”- One template per course — duplicate the design and change the artwork; store the template ID on the course record.
- Several languages — one template per language, selected from the learner’s locale.