The quarterly scramble is a familiar ritual in many companies. Spreadsheets are passed around, Slack messages fly, and managers chase their teams for the latest numbers. The goal? To update the company's Objectives and Key Results (OKRs). This manual, time-consuming process often leaves goals feeling disconnected from the actual work and data that drives them. By the time the numbers are reported, they're already stale.
What if your goals updated themselves? What if your strategic objectives were a living, breathing part of your operational workflows, reflecting real-time progress without the manual busywork?
This isn't a fantasy. It's the reality of "Goals as Code." At Goals.do, we're transforming goal management from a static reporting exercise into a dynamic, automated system. This practical guide will show you exactly how to use the Goals.do API to put your OKR updates on autopilot and connect your strategy directly to your execution.
Before we dive into the code, let's acknowledge the core problem. Traditional OKR software and spreadsheets create a fundamental disconnect:
This friction turns a powerful strategic alignment tool into just another administrative burden. Goals.do was built to eliminate this friction by treating your goals like software artifacts.
"Goals as Code" is a simple but powerful concept: you define, version, track, and automate your company's objectives using code, APIs, and SDKs. Instead of adding another standalone UI for your team to learn, Goals.do integrates goal tracking into the systems you already use.
By making goal management a native part of your codebase and operational workflows, you gain:
Now, let's see how it works in practice.
Let's walk through a common scenario: defining a product launch objective and automating its key results.
First, you define your objective and key results using our simple SDK. This code can live directly in your team's repository, providing version history and making your strategy as reviewable as your application code.
Here, we'll create an objective to launch a new version of a product.
import { Goals } from 'goals.do';
// Define and create a new company objective via the SDK
const newObjective = await Goals.create({
title: 'Launch V2 of Flagship Product',
owner: 'product-team@example.com',
timeframe: 'Q4 2024',
keyResults: [
{
description: 'Achieve 10,000 active users',
target: 10000,
current: 0,
// You can add a unique key for easy reference
key: 'V2_ACTIVE_USERS'
},
{
description: 'Secure 5 major media placements',
target: 5,
current: 1,
key: 'V2_MEDIA_HITS'
},
{
description: 'Maintain an app store rating of 4.8+',
target: 4.8,
current: 4.9,
key: 'V2_APP_RATING'
}
]
});
// The created objective will have a unique ID for future updates
console.log(newObjective.id);
// obj_abc123...
With one API call, you've created a structured, trackable objective. Now for the magic: automation.
Manually updating the Achieve 10,000 active users key result is a perfect candidate for automation. You can set up a simple script or a serverless function that runs on a schedule (e.g., a nightly cron job) to sync the latest data.
Imagine you have a data warehouse where you can query for active users. Your update script would look something like this:
import { Goals } from 'goals.do';
import { dataWarehouse } from './your-data-source'; // Your internal data connection
// The ID of the objective we created earlier
const objectiveId = 'obj_abc123';
// This function can be run on a daily schedule
async function syncActiveUsersKR() {
try {
// 1. Fetch live data from your source of truth
const result = await dataWarehouse.query('SELECT COUNT(DISTINCT user_id) as count FROM active_users WHERE launch_date >= "2024-10-01";');
const currentActiveUsers = result[0].count;
// 2. Update the Key Result in Goals.do using its unique key
const updatedKr = await Goals.updateKeyResult({
objectiveId: objectiveId,
key: 'V2_ACTIVE_USERS',
current: currentActiveUsers
});
console.log(`Successfully synced 'Active Users' KR to: ${updatedKr.current}`);
} catch (error) {
console.error('Failed to sync KR:', error);
}
}
// Execute the sync
syncActiveUsersKR();
In three simple steps within the script, you have a fully automated KR:
The power of an API-driven approach is its flexibility. You can connect Goals.do to any system that produces data or triggers events.
By integrating goal tracking directly into the tools where work happens, you create a seamless, real-time feedback loop that keeps everyone aligned and focused on what matters most.
Moving to a "Goals as Code" model with Goals.do does more than just save time. It fosters a culture of transparency and data-driven accountability. When everyone can see real-time progress tied to the company's strategic objectives, decision-making improves, and strategy truly meets execution.
Stop the quarterly scramble. Stop chasing numbers. Let your goals reflect reality, automatically.
Ready to turn your strategic goals into executable workflows? Visit Goals.do to learn more and get started with our developer-first platform.