0

Create Column

by
Published Oct 9, 2023

Creates a column.

Script monday Verified

The script

Submitted by hugo697 Bun
Verified 398 days ago
1
import monday from "monday-sdk-js";
2

3
type Monday = {
4
  token: string;
5
};
6

7
export async function main(
8
  auth: Monday,
9
  boardId: number,
10
  title: string,
11
  columnType: string
12
) {
13
  const mondayClient = monday();
14
  mondayClient.setToken(auth.token);
15
  const query = `mutation ($boardId: Int!, $title: String!, $columnType: ColumnType!) {
16
        create_column (board_id: $boardId, title: $title, column_type: $columnType) {
17
            id
18
        }
19
    }`;
20

21
  const variables = { boardId: boardId, title, columnType };
22

23
  return await mondayClient.api(query, { variables });
24
}
25