Function Types
Each function type serves a different purpose. Select the type that matches the action you want to perform.Server Function
Server Function
Makes a request to an external API. The configuration is never visible to the end user.
Upload File Function
Upload File Function
Sends files from the visitor’s browser straight to your endpoint as
multipart/form-data, one request per file. Chatbase never stores the files. Use it with the Dropzone and FileInput components, or attach it to a Button to open the visitor’s file picker. See the File Uploads guide for the endpoint contract and security practices.Besides the widget’s variables, the endpoint, headers, query parameters and form fields can use
{{conversationId}}, {{chatbotId}}, {{widgetId}}, and {{file.name}}, {{file.size}}, {{file.type}}.Client Function
Client Function
Sends a message to the parent webpage. This is designed for widgets embedded inside iframes that need to communicate with the host page.
Send Message Function
Send Message Function
Sends a message into the current conversation.
Link Function
Link Function
Opens a URL in a new browser tab.
Dismiss Function
Dismiss Function
Closes the widget. There are two ways to use this:
- Directly — Attach it to a button so the user can close the widget on click.
- As a follow-up — Use it as the follow-up action on another function (e.g., close the widget after a successful API call).
Dismissal state is persisted. If a user dismisses a widget, it stays dismissed even after a page refresh.
Set Variables Function
Set Variables Function
Updates widget data values without making any external calls. Useful for storing user selections or transforming data between steps.
Loading Behavior
When a function runs, you can control how the UI indicates progress.Additional Inputs
Sometimes a function needs extra context that depends on where it is called. For example, you might have a list of classes, each with a “Book” button that should pass a differentclassId to the same function.
{{classId}} to insert the value.
After a Function Runs
Every function supports a follow-up action that runs after it completes.- Server Function and Client Function provide two follow-up slots: On Success and On Failure.
- Upload File Function provides the same two slots, and runs the matching one once for every file. In these follow-ups
{{file.url}},{{file.name}},{{file.error}}and any Return field are available as template tokens. - Send Message, Link, Dismiss, and Set Variables functions provide a single On Execute slot.
Template Tokens
Template tokens are placeholders written as{{fieldName}} that get replaced with current values at runtime. You can use them in any setting that supports dynamic content, including URLs, headers, body content, messages, and variables.
