Skip to main content
You can write custom code to interact with your bot programmatically in many areas of Botpress Studio.
Wherever you write custom code in Studio, you can access the event object’s properties to get information about the last event in your bot’s operation.

Language

You can use TypeScript or regular JavaScript for custom code.

Where you can use code

Depending on your needs, you have a few options on where to write code in Studio. Here’s a cheat sheet: Check out each section below for a more detailed breakdown:

Actions

Actions are reusable code snippets that only Autonomous Nodes can use. Use Actions when:
  • You need to execute a piece of code more than once
  • You want AI to decide when to execute your code

Execute Code Cards

Execute Code Cards execute a one-time piece of code at some point in a Workflow. They’re not reusable and can’t be added to an Autonomous Node. Use Execute Code Cards when:
  • You only need to execute a piece of code in one place
  • You want complete control over when the code executes

Hooks

Hooks execute code at specific stages of your bot’s operation, like before every user message or after every conversation ends. They operate separately from your bot’s conversational logic—when you create a Hook, it always executes at the same stage, no matter what changes you make to your Workflow. Use Hooks when:
  • You need to execute a piece of code every time your bot reaches a certain stage of its operation
  • You need access to information about the Autonomous Node’s iteration or the current turn’s metadata

Libraries

The following libraries come pre-installed in the Studio’s code editor:
You can’t import external libraries into the Studio’s code editor.
Last modified on June 12, 2026