# Brief to workshop board with Mida

> A brief form on your website that has Mida build a workshop board before the first call.

Source: https://mockflow.com/developers/examples/api/brief-to-workshop

A consultancy asks every new client to fill in a short brief. With this example, the brief does more than land in an inbox: Mida, MockFlow's AI assistant, builds a first workshop board from the answers, such as a discovery board with goals, a customer journey and open questions, and your team gets the link before the first call.

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

## What it does

- Serves a brief form: company, goal, audience, the kind of workshop (discovery, strategy or UX) and notes.
- Turns the answers into a prompt and has Mida build the board.
- When the board is ready, posts its link and a preview image to your team's Slack channel.

## How it works

1. On start, read the workspace's [callback secret](/developers/reference/webhooks/get-callback-secret) with `GET /webhooks/callback-secret`.
2. When the form is sent, [create the board](/developers/reference/boards/create-board) with `POST /boards`, a `prompt` and a `callbackUrl`. The response carries a `job`.
3. When Mida finishes, MockFlow POSTs `{ eventId, status, boardId, boardUrl, imageUrl }` to the `callbackUrl`, [signed](/developers/concepts/webhooks#check-the-signature) with the callback secret.
4. Check the signature, answer `200` at once, ignore an `eventId` already handled, and send the link on.

Without a public address, leave `PUBLIC_URL` empty: the example then [polls the job](/developers/reference/jobs/get-job) with `GET /jobs/{jobId}` instead.

## Run the example

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

```bash
cp .env.example .env        # paste your key into .env
node server.js              # open http://localhost:3000
```

For the callback, expose the server on https, for example with `ngrok http 3000`, and set `PUBLIC_URL` to that address.

## The key code

```javascript
const board = await mf.post('/boards', {
  title: `${f.company}: ${f.workshop} workshop`,
  prompt,
  callbackUrl: `${PUBLIC_URL}/mockflow/done`,
});

// Later, at /mockflow/done
if (!verifySignature(raw, req.headers['mockflow-signature'], callbackSecret)) return res.writeHead(401).end();
res.writeHead(200).end();
const body = JSON.parse(raw);
if (body.status === 'succeeded') ready(body.boardUrl, body.imageUrl);
```

## Adapt it

- **Agencies:** a campaign brief that becomes a moodboard and a content plan.
- **Product teams:** a feature request form that becomes a first set of wireframes and a user flow.
- **Teachers:** a lesson request that becomes a lesson plan with activities.

To get the same structure every time, add a `skill` to the request; see [Term setup for teachers](/developers/examples/api/class-setup).

## What you need

An API key with `user:read`, `boards:write` and `ai:generate`. Plus or Max; each board uses the workspace's [AI credits](/developers/reference/me/get-credits).
