const API_KEY = process.env.HOOKED_API_KEY;
const BASE_URL = 'https://api.hooked.ai/v1';
const recipients = [
{ name: 'John', company: 'Acme Corp', plan: 'Pro' },
{ name: 'Sarah', company: 'TechStart', plan: 'Starter' },
{ name: 'Mike', company: 'BigCo', plan: 'Enterprise' }
];
for (const recipient of recipients) {
const response = await fetch(`${BASE_URL}/project/create`, {
method: 'POST',
headers: {
'x-api-key': API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
type: 'class',
templateId: 'template_abc123',
scenes: [
{
script: `Hi {{name}}! Welcome to {{company}}.`,
variables: [
{ key: 'name', value: recipient.name },
{ key: 'company', value: recipient.company }
]
}
],
webhook: `https://your-domain.com/webhook?user=${recipient.name}`
})
});
const data = await response.json();
console.log(`Created video for ${recipient.name}:`, data.data.projectId);
await new Promise(resolve => setTimeout(resolve, 1000));
}