Google Gmail Label
This component lets you manage Gmail labels directly from your Nappai dashboard.
You can create a new label, delete an existing one, or fetch information about one or all labels.
It works by talking to the Google Gmail API, so you’ll need a Gmail credential set up in Nappai first.
How it Works
When you add the component to a workflow, Nappai sends a request to the Gmail API using the credentials you selected.
Depending on the operation you choose, the component will:
- Create Label – send a POST request with the label name you provide.
- Delete Label – send a DELETE request for the label ID you specify.
- Get Label – send a GET request; if you leave the ID empty, it returns all labels in the account.
The component can also act as a tool for an AI agent. When you choose the “Tool” output, the agent can call the component directly with the same parameters.
Operations
This component offers several operations that you can select based on what you need to do. You can only use one operation at a time:
- Create Label: Create a new label in your Gmail account.
- Delete Label: Remove an existing label from your Gmail account.
- Get Label: Retrieve information about a specific label or list all labels if no ID is provided.
To use the component, first select the operation you need in the “Operation” field.
Inputs
Mapping Mode
This component has a special mode called “Mapping Mode”. When you enable this mode using the toggle switch, an additional input called “Mapping Data” is activated, and each input field offers you three different ways to provide data:
- Fixed: You type the value directly into the field.
- Mapped: You connect the output of another component to use its result as the value.
- Javascript: You write Javascript code to dynamically calculate the value.
This flexibility allows you to create more dynamic and connected workflows.
Input Fields
The following fields are available to configure this component. Each field may be visible in different operations:
-
Operation: Choose which action the component will perform.
- Visible in: Create Label, Delete Label, Get Label
-
Label Id: Id of the label to be used. In Get Label Operation, if empty, it will return all the labels.
- Visible in: Delete Label, Get Label
-
Label Name: Name of the label to create.
- Visible in: Create Label
-
Mapping Mode: Enable mapping mode to process multiple data records in batch.
- Visible in: Create Label, Delete Label, Get Label
-
Tool Name: The name of the tool that will be used when this component is connected as a tool. This name will be displayed to the agent when it selects tools to use.
- Visible in: Create Label, Delete Label, Get Label
-
Tool Description: A detailed description of what this tool does. This description will help the agent understand when and how to use this tool effectively.
- Visible in: Create Label, Delete Label, Get Label
-
Tools arguments metadata: Defines the arguments metadata for the tools.
- Visible in: Create Label, Delete Label, Get Label
Credential
This component requires a Gmail credential.
- Configure a GMail credential in the Credentials section of Nappai.
- Select that credential in the “Credential” field of the component.
The credential must contain a Client Id, Client Secret, and Google drive access as described in the Nappai documentation.
Outputs
- Data: The raw data returned from the Gmail API (e.g., label details or a list of labels).
- Tool: A tool representation that can be used by an AI agent to call this component directly.
Usage Example
Create a new label
- Drag the Google Gmail Label component into your workflow.
- Set Operation to Create Label.
- Enter the desired label name in Label Name (e.g., “Project X”).
- Choose your Gmail credential.
- Run the workflow.
The component will create the label and output the new label’s ID in the Data field.
Get all labels
- Set Operation to Get Label.
- Leave Label Id empty.
- Run the workflow.
The component will return a list of all labels in the Data field.
Related Components
- Google Gmail Send Email Component – Send emails using Gmail.
- Google Gmail Search Component – Search for emails in Gmail.
- Google Gmail Delete Email Component – Delete emails from Gmail.
Tips and Best Practices
- Use Mapping Mode when you need to create or delete many labels at once.
- Keep label names consistent to avoid duplicates.
- Store the label ID returned by Create Label for future reference or deletion.
- Test the component with a small number of labels before running large batch operations.
Security Considerations
- The Gmail credential contains sensitive OAuth tokens. Store it securely in Nappai’s credential store.
- Do not expose the credential or its details in logs or shared workflows.
- Use the Tool output only with trusted agents to prevent unauthorized label manipulation.