Basic usage

This quick guide will help you setup the package for common usage (but we still recommend you to read all docs for deeper understanding).

Usage examples

import { CodeBud } from '@appklaar/codebud';

// Declare array of instructions
const INSTRUCTIONS = [
  {
    id: "helloWorld",
    handler: () => {
      console.log('Hello, world!');
    }
  },
  {
    id: "sayHi",
    description: `Say "Hi!" to someone. Has 1 parameter - name to greet`,
    parametersDescription: {
      name: "string"
    },
    handler: (data: {name: string}) => {
      const greeting = `Hi, ${data.name}!`;
      console.log(greeting);
      return {greeting};
    }
  }
];

// Call the init method.
CodeBud.init("YOUR API KEY HERE", INSTRUCTIONS);

// Check package state (optionaly)
console.log('CodeBud init:', CodeBud.isInit);
console.log('CodeBud state:', CodeBud.state);

That's it! Now you can open GUI and try to send an Event.

Was this page helpful?