Skip to content
MockFlow DevelopersGet an API key

When a deal is won, create a client space, share it and add the starter boards.

Updated 14 Oct 20262 min read

An agency signs a new client and the same setup follows every time: a place for the project, the account team added, the client invited, and a kickoff board ready before the first meeting. This example does all of it from one command, so your CRM's "deal won" automation can run it.

Download the code (Node.js 18 or later, no packages)

What it creates

  • A space named after the client and the project, such as "Northwind Coffee: Website redesign".

  • The account team in the space as admin or editor, and the client's people as reviewers, who can view, comment and export.

  • A Kickoff workshop board with an agenda, a preparation checklist and a mind map of project goals.

  • A Project brief board with a brief template the client fills in, and an empty Moodboard.

How it works

  1. Check the plan's limits with GET /me/limits, so a workspace without room for another space gets a clear message instead of an error halfway through.

  2. Create the space with POST /spaces.

  3. Share it with each person with POST /spaces/{spaceId}/members. Sharing happens on the space, so everyone added can open every board in it. Each person gets an invitation email.

  4. Create the three boards with POST /boards and the space's spaceId.

  5. Fill the kickoff board in one draw with a batch: a section, a markdown agenda, a checklist and a mind map.

Each create sends an Idempotency-Key made from the client's name, so if the automation retries the same request within 24 hours, MockFlow returns the space or board it already made instead of a second one.

Run the example

Create an API key in the developer console with the scopes user:read, boards:write and members:write, then:

cp .env.example .env        # paste your key into .env
node onboard.js clients/northwind.json

Change the emails in clients/northwind.json before you run it: everyone listed gets an invitation.

The key code

const space = await mf.post('/spaces', { name: `${c.client}: ${c.project}` }, { idempotencyKey: key('space') });

for (const m of c.accountTeam) {
  await mf.post(`/spaces/${space.id}/members`, { email: m.email, role: m.role });
}
for (const email of c.clientContacts) {
  await mf.post(`/spaces/${space.id}/members`, { email, role: 'reviewer' });
}

const kickoff = await mf.post('/boards', { title: 'Kickoff workshop', spaceId: space.id }, { idempotencyKey: key('kickoff') });

Adapt it

  • Consultancies and freelancers: one space per engagement, with a discovery board and a proposal board.

  • HR and people teams: one space per new hire, with an onboarding checklist board shared with their manager and buddy.

  • Schools: one space per class; see Term setup for teachers.

What you need

An API key with user:read, boards:write and members:write. Plus or Max: Basic has one space and can share as reviewer only.

Was this page helpful?

Sign in to MockFlow

The same account you use in the app and on the API.

Forgot your password?
or
Continue with GoogleContinue with MicrosoftContinue with Apple