TwentyDEV icon

TwentyDEV

Consume the Twenty API

Actions252

Overview

This node operation updates a single connected account in the system. It allows modifying various attributes of an existing connected account such as its handle (e.g., email or username), provider, access tokens, refresh tokens, scopes, and other metadata related to synchronization and authentication status.

Common scenarios where this node is useful include:

  • Refreshing or updating OAuth tokens for a connected messaging or social media account.
  • Changing the account handle or provider information after a user update.
  • Adjusting sync-related metadata to control how deeply related objects are fetched or to track last synchronization events.
  • Managing account authorization states by updating failure timestamps or scope permissions.

Practical example: If you have integrated a messaging platform and need to update the access token or refresh token when they expire, this node can be used to update those credentials programmatically within an n8n workflow.

Properties

Name Meaning
Id The unique identifier of the connected account object to update.
Depth Determines the level of nested related objects included in the response: 0 = only primary object, 1 = primary plus directly related objects, 2 = primary plus related objects and their related objects.
Handle The account handle such as email, username, or phone number associated with the connected account.
Provider The name of the account provider (e.g., Google, Facebook, Twitter).
Access Token The access token string used for authenticating API requests to the messaging or service provider.
Refresh Token The refresh token string used to obtain new access tokens when the current one expires.
Last Sync History Id Identifier for the last synchronization event history, useful for tracking sync progress.
Auth Failed At Timestamp indicating when the last authentication failure occurred, useful for error handling or retry logic.
Handle Aliases Alternative handles or aliases associated with the account.
Scopes JSON array defining the permission scopes granted to the connected account.
Account Owner Id Identifier of the owner of the connected account, potentially linking to a user or organization entity.

Output

The node outputs a JSON object representing the updated connected account. This includes all fields sent in the update request along with any additional metadata returned by the API, such as nested related objects depending on the Depth parameter.

If the API supports returning binary data (not indicated here), it would typically represent files or attachments related to the connected account, but this node primarily deals with JSON data.

Dependencies

  • Requires an API key credential configured in n8n to authenticate requests to the external Twenty API.
  • The base URL for the API is dynamically set from the credential's domain property.
  • The node uses the Twenty API version 1.0.3 OpenAPI specification for request construction.

Troubleshooting

  • Missing or invalid Id: The update operation requires a valid connected account ID. Ensure the Id property is correctly set; otherwise, the API will reject the request.
  • Authentication errors: If the access token or API key is invalid or expired, the node will fail. Verify that the credential used has proper permissions and is up to date.
  • Invalid JSON in Scopes: The Scopes property expects a valid JSON array. Malformed JSON will cause parsing errors. Use proper JSON formatting.
  • Depth parameter misuse: Setting an unsupported depth value may result in incomplete or overly verbose responses. Use values 0, 1, or 2 as documented.
  • Network or API errors: Check connectivity and API availability if requests time out or return server errors.

Links and References

Discussion