const headers = {
Authorization: `ApiKey ${process.env.BLOCKS_API_KEY}`,
"Content-Type": "application/json",
};
const session = await fetch("https://api.blocks.team/rest/v1/sessions", {
method: "POST",
headers,
body: JSON.stringify({
agent_name: "claude",
message:
"Review this ticket and produce a short implementation plan: https://linear.app/acme-corp/issue/ENG-247/add-audit-logging-to-admin-actions",
}),
}).then((r) => r.json());
const finalPage = await fetch(session._links.final_message.href, { headers }).then((r) => r.json());
const finalMessage = finalPage.items[0]?.message;
if (finalMessage) {
await continueWorkflow({
sessionId: session.id,
blocksResult: finalMessage,
});
}