Skip to main content
penscript is the proprietary JSON language that powers every configurable element of Penbox. It adds advanced logic — conditions, calculations, loops, dynamic content — to static JSON structures. Everything visible in the Penbox UI is penscript underneath. Form structure, notification rules, automations, element visibility, case templates — all represented as JSON that the visual editor reads and writes.

Visual Editor vs penscript

The visual front-end handles most configuration needs. penscript is where the real power lives: conditional logic, complex data transformations, dynamic behavior, and configurations that go beyond what the visual editor exposes. Changes made in penscript are immediately reflected in the visual editor, and vice versa. This means there’s no “script mode” separate from the product — it’s two views of the same configuration. The visual editor is best for:
  • Standard configurations
  • Common use cases
  • Quick setup and testing
  • Learning the platform
  • Day-to-day adjustments
penscript is best for:
  • Complex conditional logic
  • Advanced calculations and transformations
  • Dynamic behavior based on data
  • Configurations beyond visual editor limits
  • API-driven configuration management

API-First Architecture

Because every configuration is JSON, the entire platform is API-manageable. penscript is what makes Penbox a natural integration layer between contact interactions and back-office systems. This enables:
  • Programmatic configuration management
  • Template generation from external systems
  • Dynamic workflow creation
  • Configuration as code
  • Version control for configurations

What You Can Do with penscript

penscript powers all configuration across Penbox: Case Configuration:
  • Define data schemas with conditional fields
  • Create automations with complex triggers
  • Build dynamic step visibility rules
  • Configure status transition logic
Form Configuration:
  • Add conditional element visibility
  • Implement dynamic validation rules
  • Create calculated fields
  • Configure multi-step conditional logic
Automation Logic:
  • Conditional status transitions
  • Data transformations and calculations
  • Dynamic step execution
  • Complex trigger conditions
Content Generation:
  • Dynamic email content
  • Conditional document sections
  • Personalized notifications
  • Variable-based templates
Integration:
  • API call configurations
  • Response data mapping
  • Request parameter building
  • Authentication logic

How penscript Works

penscript extends JSON with special syntax for dynamic behavior: Variables reference data from cases, forms, and contacts:
"{data.company_name}"
Functions perform calculations and transformations:
{":add": ["{data.base_amount}", "{data.tax_amount}"]}
Conditions control logic flow:
{":if": {":eq": "{data.country}", "belgium"}, ":then": "EU", ":else": "non-EU"}
Loops iterate over collections:
{":map": "{data.line_items}", {":multiply": "{item.quantity}", "{item.price}"}}
These building blocks combine to create sophisticated behavior while remaining readable and manageable as JSON.

Learning penscript

penscript follows consistent patterns that make it learnable:
  1. Start with variables - Reference existing data
  2. Add conditions - Make configurations dynamic
  3. Use functions - Transform and calculate
  4. Combine patterns - Build complex logic
The visual editor shows you the penscript behind every configuration, making it easy to learn by example. When you configure something visually, you can see the generated penscript and learn the patterns.

Next Steps