The open alternative to Salesforce, designed for AI.
Changelog
All notable changes to the Twenty SDK are documented in this file.
The format follows Keep a Changelog, and this package adheres to Semantic Versioning.
[Unreleased]
Breaking Changes
MetadataApiClient.uploadFileintwenty-client-sdktakes one object and no longer accepts a content type. The file now goes straight to Twenty's file storage (the API issues an upload target, the client sends the bytes there, then the API confirms the upload) instead of being streamed through the GraphQL API, and the MIME type is detected from the bytes on completion. Update every call:- const uploaded = await metadataClient.uploadFile( - fileBuffer, - 'invoice.pdf', - 'application/pdf', - FIELD_UNIVERSAL_IDENTIFIER, - ); + const uploaded = await metadataClient.uploadFile({ + fileBuffer, + filename: 'invoice.pdf', + fieldMetadataUniversalIdentifier: FIELD_UNIVERSAL_IDENTIFIER, + });The returned
{ id, path, size, createdAt, url }is unchanged.uploadFilenow requires a Twenty server that exposes thecreateFileUploadandcompleteFileUploadmutations.
Removed
- The per-file multipart fallback in
twenty app deployandtwenty app dev. Application files are only uploaded straight to file storage now (createApplicationFileUploads, PUT,completeApplicationFileUploads). The CLI no longer falls back to theuploadApplicationFilemutation on a server that lacks the batch mutations, so deploying to a server older than the direct upload fails instead of degrading.
Added
sendInboxMessageintwenty-sdk/front-component. A front component can post in members' inbox without a logic function in between. The message is still from your app; the call carries the component's token, so the member looking at the page needs the AI permission too, and an expired token is refreshed once before the call is retried. Open the conversation withnavigate:import { AppPath, navigate, sendInboxMessage, } from 'twenty-sdk/front-component'; const { threadId } = await sendInboxMessage(message); await navigate(AppPath.AiChatInbox, { threadId });Inbox mention helpers in
twenty-sdk/logic-functionandtwenty-sdk/front-component.inboxMention({ workspaceMemberId })andinboxReferenceRecord({ objectNameSingular, recordId })write the tokens the inbox renders as chips, labeled like the composer labels them: the member's full name, or the record's label identifier.INBOX_ASSISTANT_MENTIONis the composer's mention of the assistant.import { inboxMention } from 'twenty-sdk/logic-function'; const text = `${await inboxMention({ workspaceMemberId })}, the report is ready.`;attachRecordToInboxThreadanddetachRecordFromInboxThreadintwenty-sdk/logic-functionandtwenty-sdk/front-component. Link a conversation to a person, company, opportunity or custom object record, or remove the link. Both are idempotent and run like the default API clients: a member must be able to edit the conversation, and your application can act on a conversation it wrote in or one its default role was granted. The record must be readable with the same access.import { attachRecordToInboxThread } from 'twenty-sdk/logic-function'; await attachRecordToInboxThread({ threadId, objectNameSingular: 'company', recordId: company.id, });useSelectedRecordsFilterintwenty-sdk/front-component. Returns a record filter matching exactly the records the user selected, ornullwhen there is no selection context. Under Select all,useSelectedRecordIds()is empty because the selection is defined by the view's filters, search and unticked rows; query the records with this filter, or pass it to a logic function. Twenty servers that predate it returnnull.import { useSelectedRecordsFilter } from 'twenty-sdk/front-component'; const selectedRecordsFilter = useSelectedRecordsFilter();enqueueJobsintwenty-sdk/logic-function. Enqueues one run per payload of a single logic function in one call (up to 200 payloads per batch).retryLimitanddelayMsapply to every run in the batch.import { enqueueJobs } from 'twenty-sdk/logic-function'; await enqueueJobs({ logicFunctionUniversalIdentifier: PROCESS_BATCH, payloads: batches.map((batch, batchIndex) => ({ batchIndex })), });useSelectedObjectMetadataintwenty-sdk/front-component. Returns theid,nameSingularandnamePluralof the object a front component runs against, such as the object of the current record page, ornullwhen there is none. Twenty servers that predate it also returnnull. The return type is exported asFrontComponentSelectedObjectMetadata.import { useSelectedObjectMetadata } from 'twenty-sdk/front-component'; const objectMetadata = useSelectedObjectMetadata();SystemPermissionFlag.USER_APPSandSystemPermissionFlag.WORKSPACE_APPSintwenty-sdk/define. The SDK names of the User Apps and Workspace Apps permission flags, with the same universal identifiers asCONNECTED_ACCOUNTSandAPPLICATIONS. They are left out ofObject.keys,Object.valuesandObject.entries, which list the same 26 names as before, so code that enumerates or filters the flags behaves as before. Only the SDK names change: the API keeps reporting these flags asCONNECTED_ACCOUNTSandAPPLICATIONS, for example incurrentUserWorkspace.permissionFlagsand in command menu expressions.
Deprecated
enqueueJobintwenty-sdk/logic-function. UseenqueueJobswith a one-elementpayloadslist instead.enqueueJobkeeps working for now and will be removed in a future major version.SystemPermissionFlag.CONNECTED_ACCOUNTSandSystemPermissionFlag.APPLICATIONSintwenty-sdk/define. UseUSER_APPSandWORKSPACE_APPSinstead. The old names keep working and stay the onesObject.keysandObject.entriesreturn. In logic functions and front components the new names resolve only when bundled with thetwentyCLI 2.54 or later.
Changed
sendInboxMessageruns like the default API clients. It now sends throughMetadataApiClient, so in a logic function it acts as the person who triggered the run, who then needs the AI permission, and as your application only when nobody did; it used to always use the application's access. A GraphQL error now rejects with the server's message instead ofsendInboxMessage() failed: .... Its input and result are unchanged.twenty app deploysends the tarball straight to file storage. The CLI reserves an upload withcreateFileUpload, PUTs the archive to storage and registers it withcompleteAppTarballUpload, so the tarball no longer transits through the API process. Deploying to a server that predates these mutations fails instead of falling back to the multipartuploadAppTarballmutation.twenty-client-sdkshould now be a dev dependency too. Although app code imports it (CoreApiClient,MetadataApiClient,RestApiClient), Twenty provides it at runtime — logic functions get it from a generated SDK layer and front components resolve it from server-served modules — so the installed copy is only needed for typechecking and the deploy-time build. Newly scaffolded apps now place it underdevDependencies. Moving it is recommended (not required: the server already strips it from the deployed runtime), and keeps the installed app leaner:"dependencies": { - "twenty-client-sdk": "^2.13.0" }, "devDependencies": { + "twenty-client-sdk": "^2.13.0" }twenty buildnow also emits a warning whentwenty-client-sdkis still listed underdependencies.defineRoleanddefineApplicationRolekeep each permission flag once inpermissionFlagUniversalIdentifiers. A flag listed twice, for example under its deprecated and newSystemPermissionFlagnames, is sent once. Syncing a role with a repeated flag used to fail on the server.twenty app pullnames permission flags after the app's installedtwenty-sdk. Role files getSystemPermissionFlag.USER_APPSandSystemPermissionFlag.WORKSPACE_APPSwithtwenty-sdk2.54 or later, andCONNECTED_ACCOUNTSandAPPLICATIONSwith earlier versions. A flag the installedSystemPermissionFlaglacks is written as its universal identifier string.twenty app buildandtwenty app devkeep non-enumerabletwenty-sdk/defineconstants in logic function and front component bundles, soSystemPermissionFlag.USER_APPSandWORKSPACE_APPSresolve at runtime. Agent role errors also name system permission flags after the app's installedtwenty-sdk.
[2.8.0]
Breaking Changes
twenty-sdkmust now be a dev dependency. It ships thetwentyCLI and the build/scaffolding tooling, which only run at development and build time — it is never imported by a published app's runtime. Newly scaffolded apps already place it underdevDependencies. Apps created before2.8.0must move it when upgrading:"dependencies": { "twenty-client-sdk": "^2.8.0" - "twenty-sdk": "^2.8.0" }, "devDependencies": { + "twenty-sdk": "^2.8.0" }Then reinstall with
rm -rf node_modules && yarn install.twenty-client-sdkstays underdependenciesbecause app code imports it at runtime.twenty buildnow emits a warning whentwenty-sdkis still listed underdependencies, so existing apps are flagged automatically.