Skip to content

gokapso/kapso-workflows

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@kapso/workflows

Small TypeScript library for authoring Kapso workflows as code.

It builds a graph, validates obvious mistakes, and compiles to the same source shape used by kapso pull and kapso push.

import { START, Workflow } from "@kapso/workflows";

const workflow = new Workflow("inbound-support", {
  name: "Inbound Support",
});

workflow.addTrigger({
  type: "inbound_message",
  phoneNumberId: "15551234567",
});

workflow.addNode(START, {
  position: { x: 100, y: 100 },
});

workflow.addNode("normalize", {
  type: "function",
  functionSlug: "normalize-phone",
  saveResponseTo: "normalized_phone",
});

workflow.addNode("classify", {
  type: "decide",
  decisionType: "function",
  functionSlug: "classify-message",
  conditions: [
    { label: "sales", description: "Sales inquiry" },
    { label: "support", description: "Support request" },
  ],
});

workflow.addNode("support", {
  type: "call",
  workflowSlug: "support-flow",
});

workflow.addEdge(START, "normalize");
workflow.addEdge("normalize", "classify");
workflow.addEdge("classify", "support", { label: "support" });

const { metadata, definition, definitionJson } = workflow.toSourceFiles();

Commands

bun install
bun run build
bun test

Scope

This package does not execute workflows locally. It only creates source definitions.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors