Choose where you’d like to start

Get labels from Zoho Mail

Note: This task is applicable to all Zoho services, except Zoho Creator.

Overview

The zoho.mail.getLabels task is used to retrieve all the label names from your Zoho Mail account.

Syntax

<response> = zoho.mail.getLabels(<connection>);

where,

ParamsData typeDescription

<response> 

KEY-VALUE

The response that represents the color, id, and name of each label.

<connection> 

TEXT

The link name of the connection.

Note:

  • In view of stopping new authtoken generation, a Zoho OAuth connection with appropriate scopes is mandatory for new integration tasks (created after the deadline specified in the post) to work as expected. Existing integration tasks will continue to work with or without the connections parameter unless the authtoken is manually deleted from accounts.
  • The scope required for this task as mentioned by Zoho Mail API is tags.
  • Refer to this post for the list of Zoho services that support the connections page.
  • Learn more about connections

Example

The following script retrieves all labels from Zoho Mail:

response = zoho.mail.getLabels("mail_oauth_connection");

where:

response
The KEY-VALUE response that represents the details of the labels fetched from Zoho Mail.
"mail_oauth_connection"
The TEXT that represents the link name of Zoho Mail oauth connection.

Response Format

Success Response

  • The success response will be returned in the following format:

      {
    "COLOR":"#FFD700",
       "ID":6729326000000008027,
       "NAME":"Notification"
    },
    {  
    "COLOR":"#FFD700",
       "ID":6729326000000008029,
       "NAME":"NewsLetter"
    },

    "COLOR":"#FFD700",
       "ID":6729326000000008031,
       "NAME":"Blog"
    }

   

To fetch the IDs of the tags from the success response obtained, execute the following snippet:

 for each var in <response_variable>
 {
 info var.get("ID");
 }
   

To fetch the names of the tags from the success response obtained, execute the following snippet:

 for each var in <response_variable>
 {
 info var.get("NAME");
 }

Related Links

Get Started Now

Execute