Node SDK
A thin, typed wrapper over the public API.
Install
bash
npm install @hookbird/nodeSet up
ts
import Hookbird from '@hookbird/node';
const hookbird = new Hookbird(process.env.HOOKBIRD_API_KEY!, 'https://app.hookbird.ai/api');The second argument is the API base (without /public/v1). Or set HOOKBIRD_API_URL.
Score, make, poll
ts
const { score, rewrite } = await hookbird.scoreHook({
text: "POV: it's 11pm and your accountant wants 43 receipts",
platform: 'tiktok',
});
const { id } = await hookbird.generate({ formatId: 'wall_of_text', input: { hook: rewrite } });
let gen = await hookbird.generation(id);
while (['queued', 'running'].includes(gen.status)) {
await new Promise((r) => setTimeout(r, 5000));
gen = await hookbird.generation(id);
}
console.log(score, gen.outputs); // [{ id, path, type, role }]Methods
| Method | Does |
|---|---|
| ping() | Check the key |
| brand() | Brand profile |
| scoreHook({ text, platform?, audienceId? }) | Score a hook (free) |
| generateHooks({ topic?, audienceId?, platform?, count? }) | Scored hooks (free) |
| studioFormats() | Formats and prices |
| generate({ formatId, input }) | Start a generation (credits) |
| generation(id) · generations({ status?, limit? }) | Poll / list |
| credits() | Credits left |
| upload(buffer, extension) | Upload media |
| integrations() | Connected channels |
| post(posts) · postList(filters) · deletePost(id) | Schedule, list, delete |
Errors
Hooks, brand and Studio methods throw an Error with status and body when the API answers with an error. See API errors.