Show examples in:
    Create a new workflow

    Parameters

    id  string  Required
    ID of workflow
    name  string  Required

    The name of the workflow

    stages  Array<object>  Required

    The stages of the workflow

    Returns

    Returns a workflow resource object.

    Examples

    Example code:
    import { buildClient } from '@datocms/cma-client-node';
    async function run() {
    const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });
    const workflow = await client.workflows.create({
    id: 'approval_by_editors',
    name: 'Approval by editors required',
    stages: [
    {
    id: 'waiting_for_review',
    name: 'Waiting for review',
    initial: true
    }
    ]
    });
    console.log(workflow);
    }
    run();
    Returned output:
    {
    id: 'approval_by_editors',
    name: 'Approval by editors required',
    stages: [
    {
    id: 'waiting_for_review',
    name: 'Waiting for review',
    initial: true
    }
    ]
    }