When a user hits a milestone, give them an image they can post. One template per achievement type, one URL per user.
Your user hits a milestone. 100-day streak, first deploy, 10,000 steps. You send a push that says "Congrats!" They see it, maybe smile, and move on. Nobody screenshots a toast notification.
Spotify Wrapped works because the output is a good-looking image you can post. But building your own image generation for every achievement type is a real engineering project. Most teams skip it.
Make a template for each kind of achievement: badges, year-in-review cards, certificates. Each template takes variables like the user's name, stats, and rarity level.
When a user unlocks something, mint a signed URL with their data. Give them the image link. They share it on Twitter, LinkedIn, wherever. You get organic reach without paying for ads.
1// User just hit a milestone — mint their achievement card2const res = await fetch("https://api.htmlpix.com/v1/url", {3 method: "POST",4 headers: {5 Authorization: `Bearer ${process.env.HTMLPIX_KEY}`,6 "Content-Type": "application/json",7 },8 body: JSON.stringify({9 templateId: ACHIEVEMENT_TEMPLATE_ID,10 variables: {11 title: "First Deploy",12 description: "Shipped your first project to production",13 username: "player_one",14 xp: "+500 XP",15 rarity: "Legendary",16 accentColor: "#f59e0b",17 },18 width: 1200,19 height: 630,20 }),21});2223const { url } = await res.json();24// url → shareable image link for Twitter, LinkedIn, etc.type Rarity = "Common" | "Rare" | "Epic" | "Legendary";
export async function mintAchievementCard(opts: {
title: string;
description: string;
username: string;
xp: string;
rarity: Rarity;
}) {
const res = await fetch("https://api.htmlpix.com/v1/url", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.HTMLPIX_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
templateId: process.env.ACHIEVEMENT_TEMPLATE_ID,
variables: opts,
width: 1200,
height: 630,
}),
});
const { url } = await res.json();
return url; // Ready to share on social media
}Build an image generation pipeline with Canvas or Sharp. Design each badge variant manually. Maintain it as you add new achievement types.
One template per achievement type. Mint a URL with the user's data. New achievements = new variables, not new code.
Every time a user shares their achievement card, your brand is in the image. You don't pay for that impression.
You don't need Canvas, Sharp, or Puppeteer. One template covers all badge variations. Change the variables, get a different image.
The starter Achievement template supports rarity levels (Common through Legendary) with different colors. XP values, usernames, badge icons.
Make Spotify Wrapped-style cards with your user's yearly stats. One template, mint per user at year end.
A unique social preview for every page on your site. One template, one API call.
Personalized stats, dashboards, and banners rendered as images. Works in every email client.
Post your key metrics to Slack or email as a clean dashboard image. Runs on a cron job.
One template, a spreadsheet of copy, and you have all your ad variants in minutes.
Just migrated our OG images to @htmlpix. Should have done this months ago.
Show customer quotes on your site as styled cards. No embed scripts, no API keys.
Branded product cards generated from your database. For social, email, and marketplaces.