Coe Points run structured or unstructured code. Common use cases include HTTP requests to external systems and complex data transformations.

Code Points will run all properly structured code within the point, and must contain either an execute_process() function, a get_component() function, or both.

  • execute_process() - Runs code. Values that are returned will attempt to write to the data token.
  • get_component() - Builds defined Form Builder components and will attempt to write defined values to the data token.
Example

Code point

{
  "organization_id": "org_6595cb88cef61bf614830d14",
  "name": "load_blurb",
  "version": "latest",
  "code": "async function execute_process() {\n  let blurb = _token.blurb;\n  let blurbs = _token.blurbs;\n  const revised_blurbs = blurbs ? [...blurbs, blurb] : [blurb];\n\n  return { \"blurbs\" : revised_blurbs,\n  \"blurb.loaded\": \"yes\",\n  \"agent_helpers.metadata.friendly_name\": _token.friendly_name,\n  \"agent_helpers.metadata.description\": _token.description,\n  \"agent_helpers.metadata.instructions\": _token.instructions,\n  \"agent_helpers.metadata.response\": _token.response\n  };\n}",
  "language": "javascript",
  "imports": [],
  "parameters": [],
  "tags": [
    "melodyarc-admin",
    "expert-service"
  ]
}

Formatted View of Code

async function execute_process() {
  let blurb = _token.blurb;
  let blurbs = _token.blurbs;
  const revised_blurbs = blurbs ? [...blurbs, blurb] : [blurb];

  return {
  "blurbs" : revised_blurbs,
  "blurb.loaded": "yes",
  "agent_helpers.metadata.friendly_name": _token.friendly_name,
  "agent_helpers.metadata.description": _token.description,
  "agent_helpers.metadata.instructions": _token.instructions,
  "agent_helpers.metadata.response": _token.response
  };
};

Highlighted Keys

  • imports : An array of other points. Imported points can be used as global functions within a code point.

    E.g. "imports": ["gorgias_api", "fill_text"]

  • language : Language of code used.

    E.g. "language": "JavaScript"

  • parameters : An array of key or value points. Points named as parameters can be used as global variables within a Code Point.

    E.g. "parameters": ["__gorgias_access_token", "gorgias_subdomain"]

  • version : An automated versioning of the code point based on writes. The version latest will always be run.

    E.g. "version": "latest"

Fill Triggers

Code Points are triggered by invoke points or when directly called in a directed fill.


What’s Next