Skip to main content

Getting Started

Let's build your first Culvii workflow. We'll install the SDK, write a simple "Hello World" workflow, and run it.

1. Configure npm

First, tell npm where to find the Culvii package. Create an .npmrc file in your project root and add the Culvii registry.

@culvii:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}

Make sure your NODE_AUTH_TOKEN environment variable has access to the Culvii package.

2. Install the SDK

Install @culvii/kit using your preferred package manager.

pnpm add @culvii/kit

3. Write a Hello World workflow

A workflow is a sequence of steps. Let's create a simple workflow that takes a name and returns a greeting.

Create a file named hello.ts and add this code:

import { Workflow, Step } from '@culvii/kit';

const triggerStep = new Step({
id: 'trigger',
name: 'Manual Trigger',
type: 'manualTrigger'
});

const greetStep = new Step({
id: 'greet',
name: 'Generate Greeting',
type: 'core.set',
params: {
values: {
message: 'Hello, World!'
}
}
});

triggerStep.connectTo(greetStep);

export const helloWorkflow = new Workflow({
name: 'Hello World Workflow',
steps: [triggerStep, greetStep]
});

This code defines a trigger step and an action step that sets a greeting message. Then it connects them and wraps them in a workflow.

4. Deploy the workflow

Now you can deploy your workflow to the platform. You just need to call the save method and pass your deployment options.

async function main() {
const result = await helloWorkflow.save({
baseUrl: 'https://api.culvii.com',
cloneId: 'your-clone-id',
workbookId: 'your-workbook-id',
token: 'your-auth-token'
});

console.log('Workflow deployed successfully!', result.data);
}

main();

That's it. You just built and ran your first Culvii workflow. Next, let's look at the core concepts to understand how everything fits together.