What the logic layer covers
A Twenty app’s logic layer is the code that runs — server-side TypeScript handlers reacting to HTTP requests, cron schedules, and record changes; AI skills and agents that live inside the workspace; connections (OAuth or a custom sign-in flow) that let your functions act on a user’s behalf in third-party services; and messaging channels that bring an external inbox into Twenty.In this section
Logic Functions
The core building block — trigger types, payloads, and the typed API client.Skills & Agents
Reusable AI agent instructions and assistants with custom system prompts.Workflows
Ready-made workflows installed with your app: triggers, steps, and how they run.Connections
OAuth credentials your app holds for third-party services — Linear, GitHub, Slack, and more.Messaging Channels
Bring conversations from any provider into Twenty’s Message and Message Thread records — threading and de-duplication included.Inbox
Post messages in members’ inbox from logic functions and front components.Key-Value Store
Persist state between logic function runs — caches, cursors, and cross-workspace claims.Background Jobs
Enqueue a logic function run on the workers to get past the per-run timeout.Charging Credits
Declare what your app bills for and charge workspace credits for it.Trigger types at a glance
A logic function picks one or more triggers — every entry below is a separate field ondefineLogicFunction():
Functions run sandboxed in isolated Node.js processes and access the workspace through a typed API client scoped to the role declared on
defineApplication().
Install-time hooks — code that runs before or after the install — share this runtime but use their own define functions and live under Config → Install Hooks.The health check shares it too. An app declares one check with no trigger. By default, Twenty calls its zero-argument handler when workspace app settings open. Set
runOnUserPreferences: true to run it on a member’s Apps preferences page instead, with their required userWorkspaceId.