# Monday sprint board from your issue tracker

> Every Monday, turn open issues into a kanban for each squad and post the link.

Source: https://mockflow.com/developers/examples/api/sprint-board

A product team plans the week on Monday morning, and the plan lives in an issue tracker few people enjoy looking at. This example builds a visual sprint board from the open issues instead: one section per squad, each with a kanban whose columns are Backlog, In progress, In review and Done. The link goes to the team's Slack channel.

[**Download the code**](/developers/assets/examples/mockflow-sprint-board.zip) (Node.js 18 or later, no packages)

## What it creates

- A board titled "Sprint board, week of" and the Monday's date.
- A section for each squad, holding a [kanban](/developers/reference/item-types/kanban) with one card per issue: the issue number and title, assignee, labels and priority.
- A message in Slack with the board's link, when a Slack incoming webhook is set.

## How it works

1. Read the open issues: from `issues.sample.json`, or from GitHub when `GITHUB_REPO` is set, with squads and statuses taken from labels such as `squad:Checkout` and `status:In review`.
2. [Create the board](/developers/reference/boards/create-board) with `POST /boards`. The week is the `Idempotency-Key`, so running it twice on the same Monday returns the same board.
3. Draw every section and kanban in one go with a [batch](/developers/reference/items/batch-items), `POST /boards/{boardId}/items:batch`, which takes up to 100 operations and answers with a [job](/developers/reference/jobs/get-job).
4. Post the board's `url` to Slack.

## Run the example

Create an API key in the [developer console](/developers/console/) with the scopes `user:read` and `boards:write`, then:

```bash
cp .env.example .env        # paste your key into .env
node sprint-board.js
```

To run it every Monday at 8:00, add it to cron or to a scheduled CI job:

```bash
0 8 * * 1 cd /path/to/sprint-board && node sprint-board.js
```

## The key code

```javascript
const board = await mf.post('/boards', { title: `Sprint board, week of ${week}` }, { idempotencyKey: `sprint-${week}` });

const operations = [];
squads.forEach((squad, i) => {
  const y = i * 1000;
  operations.push({ op: 'create', item: { type: 'section', position: { x: 0, y }, size: { width: 1800, height: 900 }, data: { title: squad } } });
  operations.push({ op: 'create', item: { type: 'kanban', position: { x: 40, y: y + 80 }, data: kanbanFor(squad) } });
});
await mf.batch(board.id, operations);
```

## Adapt it

- **Jira, Linear, Asana or Trello:** replace `githubIssues()` with a call to that tool's API; the board part stays the same.
- **Support teams:** open tickets by queue, with a column per status.
- **Content teams:** this week's articles by channel, from the editorial calendar.

## What you need

An API key with `user:read` and `boards:write`. Every plan; Basic makes three boards in total, so on Basic delete last week's board before the next run.
