Actions102
- Account Actions
- Built-In Variable Actions
- Client Actions
- Container Actions
- Destination Actions
- Environment Actions
- Folder Actions
- Google Tag Configuration Actions
- Tag Actions
- Template Actions
- Transformation Actions
- Trigger Actions
- User Permission Actions
- Variable Actions
- Version Actions
- Workspace Actions
- Zone Actions
Overview
This node integrates with the Google Tag Manager (GTM) API, allowing users to manage various GTM resources programmatically within n8n workflows. Specifically, for the Workspace resource and the Create Workspace operation, it enables creating a new workspace inside a specified GTM container.
A workspace in GTM is an environment where changes can be made and tested before publishing them live. This node operation is useful for automating the creation of workspaces when managing multiple containers or accounts, facilitating CI/CD pipelines, or integrating GTM management into broader automation workflows.
Practical example:
- Automatically create a new workspace in a GTM container when starting a new project phase or campaign, ensuring isolated development and testing environments.
- Use in combination with other GTM operations to automate container versioning and deployment processes.
Properties
| Name | Meaning |
|---|---|
| Account ID | The GTM Account ID under which the container exists. |
| Container ID | The GTM Container ID where the workspace will be created. |
| Optional Query Parameters | Additional optional parameters for the API request; not typically required for workspace creation. |
| Request Body | JSON object representing the details of the workspace to create. This may include workspace name and description as per GTM API specification. |
Note: For the Create Workspace operation, the essential inputs are the Account ID, Container ID, and optionally a Request Body with workspace details.
Output
The output is a JSON array containing the response from the Google Tag Manager API after creating the workspace. The structure corresponds to the GTM Workspace resource, typically including fields such as:
name: The API resource name of the workspace.path: The API path to the workspace.workspaceId: The unique identifier of the workspace.description: Description of the workspace.fingerprint: Used for optimistic concurrency control.- Other metadata related to the workspace.
No binary data is output by this node.
Dependencies
- Requires valid Google Tag Manager API credentials configured in n8n using OAuth2 authentication.
- The node uses the Google Tag Manager API endpoint
https://www.googleapis.com/tagmanager/v2. - Proper permissions on the GTM account and container are necessary to create workspaces.
Troubleshooting
- Missing Credentials Error: If the node throws an error about missing credentials, ensure that the Google Tag Manager API OAuth2 credentials are properly set up in n8n.
- Required Parameter Errors: The node validates presence of required parameters like Account ID and Container ID. Missing these will cause errors. Double-check input values.
- API Errors: Errors returned from the GTM API (e.g., permission denied, invalid container ID) will be surfaced with messages prefixed by "Error calling GTM API". Review the message and stack trace for details.
- Invalid Request Body: If the JSON in the Request Body is malformed or does not conform to the expected schema, the API will reject the request. Validate JSON syntax and content.
Links and References
- Google Tag Manager API Documentation - Workspaces
- Google Tag Manager Concepts - Workspaces
- n8n Documentation - Using OAuth2 Credentials
This summary focuses on the Workspace resource's Create Workspace operation as requested, based on static analysis of the provided source code and property definitions.