Setting up Gmail automation

I’m trying to get a summary of all my unread, labelled emails in Gmail, run them through Gemini and then get the summary sent to my Telegram bot. Got all the credentials and the workflow set up.

When running the workflow, the gmail node seems to pull in the data fine (text item in the schema), but the Agent node cannot get the text from all the unread emails and most of the messages I get to my bot are “I’m still receiving an empty value for the text field”. This is although 2 of the unread emails got summarised and came through to the bot correctly. After running the workflow again, I did not get any more summaries, and instead keep getting the following telegram message: “I am unable to process your request to extract the text from your emails. The tool Gmail1 can only be used to retrieve messages from the Gmail API, but it does not have the functionality to parse JSON or extract specific fields like “text”.”

No error message on the workflow, just seemingly missing something crucial. Bear in mind, the workflow does not seem to use the tool node “Gmail1” attached to the AI Agent, as I could not get the workflow to work without the Gmail node after the schedule trigger…

Would also be great to just receive 1 Telegram message, instead of the amount of emails it parses and sending a separate one… Also quite new here, so just learning! Would appreciate any help :slight_smile:

Here is the Agent node code:

Share the output returned by the last node

[
  {
    "ok": true,
    "result": {
      "message_id": 212,
      "from": {
        "id": 7823671008,
        "is_bot": true,
        "first_name": "Gmail",
        "username": "Akh_Gemini_Bot"
      },
      "chat": {
        "id": 436761695,
        "first_name": "B",
        "username": "Robis74",
        "type": "private"
      },
      "date": 1745615893,
      "text": "I am unable to fulfill your request to extract the text content from your emails. The Gmail1 tool can only retrieve messages from the Gmail API. It does not have the ability to parse JSON or extract specific fields like \"text\".\n\n\nThis message was sent automatically with n8n",
      "entities": [
        {
          "offset": 86,
          "length": 6,
          "type": "code"
        },
        {
          "offset": 230,
          "length": 41,
          "type": "italic"
        },
        {
          "offset": 271,
          "length": 3,
          "type": "text_link",
          "url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_9d593e1bfc8e736af9d6c0252a2d24b7f2550466563ed29fbda840b87d0b069d"
        }
      ],
      "link_preview_options": {
        "is_disabled": true
      }
    }
  },
  {
    "ok": true,
    "result": {
      "message_id": 213,
      "from": {
        "id": 7823671008,
        "is_bot": true,
        "first_name": "Gmail",
        "username": "Akh_Gemini_Bot"
      },
      "chat": {
        "id": 436761695,
        "first_name": "B",
        "username": "Robis74",
        "type": "private"
      },
      "date": 1745615893,
      "text": "I am unable to extract the text content from your emails. The Gmail1 tool can only retrieve messages from the Gmail API, but it cannot parse JSON or extract specific fields like \"text\".\n\n\nThis message was sent automatically with n8n",
      "entities": [
        {
          "offset": 62,
          "length": 6,
          "type": "code"
        },
        {
          "offset": 188,
          "length": 41,
          "type": "italic"
        },
        {
          "offset": 229,
          "length": 3,
          "type": "text_link",
          "url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_9d593e1bfc8e736af9d6c0252a2d24b7f2550466563ed29fbda840b87d0b069d"
        }
      ],
      "link_preview_options": {
        "is_disabled": true
      }
    }
  },
  {
    "ok": true,
    "result": {
      "message_id": 214,
      "from": {
        "id": 7823671008,
        "is_bot": true,
        "first_name": "Gmail",
        "username": "Akh_Gemini_Bot"
      },
      "chat": {
        "id": 436761695,
        "first_name": "B",
        "username": "Robis74",
        "type": "private"
      },
      "date": 1745615893,
      "text": "Unfortunately, I am unable to process your request. The Gmail1 tool is designed to retrieve messages from the Gmail API, but it lacks the functionality to parse JSON or extract specific fields such as \"text\".\n\n\nThis message was sent automatically with n8n",
      "entities": [
        {
          "offset": 56,
          "length": 6,
          "type": "code"
        },
        {
          "offset": 211,
          "length": 41,
          "type": "italic"
        },
        {
          "offset": 252,
          "length": 3,
          "type": "text_link",
          "url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_9d593e1bfc8e736af9d6c0252a2d24b7f2550466563ed29fbda840b87d0b069d"
        }
      ],
      "link_preview_options": {
        "is_disabled": true
      }
    }
  },
  {
    "ok": true,
    "result": {
      "message_id": 215,
      "from": {
        "id": 7823671008,
        "is_bot": true,
        "first_name": "Gmail",
        "username": "Akh_Gemini_Bot"
      },
      "chat": {
        "id": 436761695,
        "first_name": "B",
        "username": "Robis74",
        "type": "private"
      },
      "date": 1745615894,
      "text": "I am unable to fulfill your request to extract the text from your emails using the available tools. The Gmail1 tool can only retrieve messages from the Gmail API, but it does not have the functionality to parse JSON or extract specific fields like \"text\".\n\n\nThis message was sent automatically with n8n",
      "entities": [
        {
          "offset": 104,
          "length": 6,
          "type": "code"
        },
        {
          "offset": 258,
          "length": 41,
          "type": "italic"
        },
        {
          "offset": 299,
          "length": 3,
          "type": "text_link",
          "url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_9d593e1bfc8e736af9d6c0252a2d24b7f2550466563ed29fbda840b87d0b069d"
        }
      ],
      "link_preview_options": {
        "is_disabled": true
      }
    }
  },
  {
    "ok": true,
    "result": {
      "message_id": 216,
      "from": {
        "id": 7823671008,
        "is_bot": true,
        "first_name": "Gmail",
        "username": "Akh_Gemini_Bot"
      },
      "chat": {
        "id": 436761695,
        "first_name": "B",
        "username": "Robis74",
        "type": "private"
      },
      "date": 1745615894,
      "text": "I am sorry, I cannot fulfill this request. The available tool Gmail1 is designed to retrieve messages from the Gmail API. It does not have the capacity to parse JSON structures or extract text content from emails.\n\n\nThis message was sent automatically with n8n",
      "entities": [
        {
          "offset": 62,
          "length": 6,
          "type": "code"
        },
        {
          "offset": 216,
          "length": 41,
          "type": "italic"
        },
        {
          "offset": 257,
          "length": 3,
          "type": "text_link",
          "url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_9d593e1bfc8e736af9d6c0252a2d24b7f2550466563ed29fbda840b87d0b069d"
        }
      ],
      "link_preview_options": {
        "is_disabled": true
      }
    }
  },
  {
    "ok": true,
    "result": {
      "message_id": 217,
      "from": {
        "id": 7823671008,
        "is_bot": true,
        "first_name": "Gmail",
        "username": "Akh_Gemini_Bot"
      },
      "chat": {
        "id": 436761695,
        "first_name": "B",
        "username": "Robis74",
        "type": "private"
      },
      "date": 1745615894,
      "text": "I apologize, but I am unable to complete your request. The Gmail1 tool can only retrieve messages from the Gmail API. It does not have the ability to parse JSON or extract specific fields like \"text\".\n\n\nThis message was sent automatically with n8n",
      "entities": [
        {
          "offset": 59,
          "length": 6,
          "type": "code"
        },
        {
          "offset": 203,
          "length": 41,
          "type": "italic"
        },
        {
          "offset": 244,
          "length": 3,
          "type": "text_link",
          "url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_9d593e1bfc8e736af9d6c0252a2d24b7f2550466563ed29fbda840b87d0b069d"
        }
      ],
      "link_preview_options": {
        "is_disabled": true
      }
    }
  },
  {
    "ok": true,
    "result": {
      "message_id": 218,
      "from": {
        "id": 7823671008,
        "is_bot": true,
        "first_name": "Gmail",
        "username": "Akh_Gemini_Bot"
      },
      "chat": {
        "id": 436761695,
        "first_name": "B",
        "username": "Robis74",
        "type": "private"
      },
      "date": 1745615894,
      "text": "I am unable to access the content of your emails, as the available tool Gmail1 can only retrieve messages from the Gmail API, but it cannot parse JSON or extract specific fields like \"text\". Therefore, I cannot summarize your unread emails or provide financial advice based on their content.\n\n\nThis message was sent automatically with n8n",
      "entities": [
        {
          "offset": 72,
          "length": 6,
          "type": "code"
        },
        {
          "offset": 294,
          "length": 41,
          "type": "italic"
        },
        {
          "offset": 335,
          "length": 3,
          "type": "text_link",
          "url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_9d593e1bfc8e736af9d6c0252a2d24b7f2550466563ed29fbda840b87d0b069d"
        }
      ],
      "link_preview_options": {
        "is_disabled": true
      }
    }
  },
  {
    "ok": true,
    "result": {
      "message_id": 219,
      "from": {
        "id": 7823671008,
        "is_bot": true,
        "first_name": "Gmail",
        "username": "Akh_Gemini_Bot"
      },
      "chat": {
        "id": 436761695,
        "first_name": "B",
        "username": "Robis74",
        "type": "private"
      },
      "date": 1745615894,
      "text": "I'm sorry, but I am unable to complete your request. The Gmail1 tool can only retrieve messages from the Gmail API. It does not have the ability to parse JSON or extract specific fields like \"text\".\n\n\nThis message was sent automatically with n8n",
      "entities": [
        {
          "offset": 57,
          "length": 6,
          "type": "code"
        },
        {
          "offset": 201,
          "length": 41,
          "type": "italic"
        },
        {
          "offset": 242,
          "length": 3,
          "type": "text_link",
          "url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_9d593e1bfc8e736af9d6c0252a2d24b7f2550466563ed29fbda840b87d0b069d"
        }
      ],
      "link_preview_options": {
        "is_disabled": true
      }
    }
  },
  {
    "ok": true,
    "result": {
      "message_id": 220,
      "from": {
        "id": 7823671008,
        "is_bot": true,
        "first_name": "Gmail",
        "username": "Akh_Gemini_Bot"
      },
      "chat": {
        "id": 436761695,
        "first_name": "B",
        "username": "Robis74",
        "type": "private"
      },
      "date": 1745615894,
      "text": "I am unable to fulfill your request because the Gmail1 tool can only retrieve messages from the Gmail API. It lacks the functionality to parse JSON or extract specific fields such as \"text.\" Therefore, I cannot summarize your emails or provide financial advice based on their content.\n\n\nThis message was sent automatically with n8n",
      "entities": [
        {
          "offset": 48,
          "length": 6,
          "type": "code"
        },
        {
          "offset": 287,
          "length": 41,
          "type": "italic"
        },
        {
          "offset": 328,
          "length": 3,
          "type": "text_link",
          "url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_9d593e1bfc8e736af9d6c0252a2d24b7f2550466563ed29fbda840b87d0b069d"
        }
      ],
      "link_preview_options": {
        "is_disabled": true
      }
    }
  },
  {
    "ok": true,
    "result": {
      "message_id": 221,
      "from": {
        "id": 7823671008,
        "is_bot": true,
        "first_name": "Gmail",
        "username": "Akh_Gemini_Bot"
      },
      "chat": {
        "id": 436761695,
        "first_name": "B",
        "username": "Robis74",
        "type": "private"
      },
      "date": 1745615894,
      "text": "I am unable to fulfill this request. The available tool Gmail1 is designed to retrieve messages from the Gmail API, but it does not have the capacity to parse JSON structures or extract text content from emails. Therefore, I cannot summarize your emails or provide financial advice based on their content.\n\n\nThis message was sent automatically with n8n",
      "entities": [
        {
          "offset": 56,
          "length": 6,
          "type": "code"
        },
        {
          "offset": 308,
          "length": 41,
          "type": "italic"
        },
        {
          "offset": 349,
          "length": 3,
          "type": "text_link",
          "url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_9d593e1bfc8e736af9d6c0252a2d24b7f2550466563ed29fbda840b87d0b069d"
        }
      ],
      "link_preview_options": {
        "is_disabled": true
      }
    }
  },
  {
    "ok": true,
    "result": {
      "message_id": 222,
      "from": {
        "id": 7823671008,
        "is_bot": true,
        "first_name": "Gmail",
        "username": "Akh_Gemini_Bot"
      },
      "chat": {
        "id": 436761695,
        "first_name": "B",
        "username": "Robis74",
        "type": "private"
      },
      "date": 1745615894,
      "text": "I am unable to complete that request. The Gmail1 tool can only retrieve messages from the Gmail API, but it cannot parse JSON or extract specific fields like \"text\".\n\n\nThis message was sent automatically with n8n",
      "entities": [
        {
          "offset": 42,
          "length": 6,
          "type": "code"
        },
        {
          "offset": 168,
          "length": 41,
          "type": "italic"
        },
        {
          "offset": 209,
          "length": 3,
          "type": "text_link",
          "url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_9d593e1bfc8e736af9d6c0252a2d24b7f2550466563ed29fbda840b87d0b069d"
        }
      ],
      "link_preview_options": {
        "is_disabled": true
      }
    }
  },
  {
    "ok": true,
    "result": {
      "message_id": 223,
      "from": {
        "id": 7823671008,
        "is_bot": true,
        "first_name": "Gmail",
        "username": "Akh_Gemini_Bot"
      },
      "chat": {
        "id": 436761695,
        "first_name": "B",
        "username": "Robis74",
        "type": "private"
      },
      "date": 1745615894,
      "text": "I cannot fulfill this request. The tool Gmail1 can only retrieve messages from the Gmail API, but it can't parse JSON or extract text.\n\n\nThis message was sent automatically with n8n",
      "entities": [
        {
          "offset": 40,
          "length": 6,
          "type": "code"
        },
        {
          "offset": 137,
          "length": 41,
          "type": "italic"
        },
        {
          "offset": 178,
          "length": 3,
          "type": "text_link",
          "url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_9d593e1bfc8e736af9d6c0252a2d24b7f2550466563ed29fbda840b87d0b069d"
        }
      ],
      "link_preview_options": {
        "is_disabled": true
      }
    }
  },
  {
    "ok": true,
    "result": {
      "message_id": 224,
      "from": {
        "id": 7823671008,
        "is_bot": true,
        "first_name": "Gmail",
        "username": "Akh_Gemini_Bot"
      },
      "chat": {
        "id": 436761695,
        "first_name": "B",
        "username": "Robis74",
        "type": "private"
      },
      "date": 1745615894,
      "text": "I am unable to process this request. The Gmail1 tool is designed to retrieve messages from the Gmail API, but it lacks the functionality to parse JSON or extract specific fields like \"text\". Therefore, I cannot summarize your emails or provide financial advice based on their content.\n\n\nThis message was sent automatically with n8n",
      "entities": [
        {
          "offset": 41,
          "length": 6,
          "type": "code"
        },
        {
          "offset": 287,
          "length": 41,
          "type": "italic"
        },
        {
          "offset": 328,
          "length": 3,
          "type": "text_link",
          "url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_9d593e1bfc8e736af9d6c0252a2d24b7f2550466563ed29fbda840b87d0b069d"
        }
      ],
      "link_preview_options": {
        "is_disabled": true
      }
    }
  },
  {
    "ok": true,
    "result": {
      "message_id": 225,
      "from": {
        "id": 7823671008,
        "is_bot": true,
        "first_name": "Gmail",
        "username": "Akh_Gemini_Bot"
      },
      "chat": {
        "id": 436761695,
        "first_name": "B",
        "username": "Robis74",
        "type": "private"
      },
      "date": 1745615894,
      "text": "I am sorry, I cannot fulfill this request. The available tool Gmail1 can only retrieve messages from the Gmail API. It does not have the ability to parse JSON or extract text content.\n\n\nThis message was sent automatically with n8n",
      "entities": [
        {
          "offset": 62,
          "length": 6,
          "type": "code"
        },
        {
          "offset": 186,
          "length": 41,
          "type": "italic"
        },
        {
          "offset": 227,
          "length": 3,
          "type": "text_link",
          "url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_9d593e1bfc8e736af9d6c0252a2d24b7f2550466563ed29fbda840b87d0b069d"
        }
      ],
      "link_preview_options": {
        "is_disabled": true
      }
    }
  },
  {
    "ok": true,
    "result": {
      "message_id": 226,
      "from": {
        "id": 7823671008,
        "is_bot": true,
        "first_name": "Gmail",
        "username": "Akh_Gemini_Bot"
      },
      "chat": {
        "id": 436761695,
        "first_name": "B",
        "username": "Robis74",
        "type": "private"
      },
      "date": 1745615894,
      "text": "I'm sorry, but I am unable to complete your request. The Gmail1 tool can only retrieve messages from the Gmail API. It does not have the functionality to parse JSON or extract the text content from the messages.\n\n\nThis message was sent automatically with n8n",
      "entities": [
        {
          "offset": 57,
          "length": 6,
          "type": "code"
        },
        {
          "offset": 214,
          "length": 41,
          "type": "italic"
        },
        {
          "offset": 255,
          "length": 3,
          "type": "text_link",
          "url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_9d593e1bfc8e736af9d6c0252a2d24b7f2550466563ed29fbda840b87d0b069d"
        }
      ],
      "link_preview_options": {
        "is_disabled": true
      }
    }
  },
  {
    "ok": true,
    "result": {
      "message_id": 227,
      "from": {
        "id": 7823671008,
        "is_bot": true,
        "first_name": "Gmail",
        "username": "Akh_Gemini_Bot"
      },
      "chat": {
        "id": 436761695,
        "first_name": "B",
        "username": "Robis74",
        "type": "private"
      },
      "date": 1745615894,
      "text": "I am unable to provide a response to your request. The available tool Gmail1 can only retrieve messages from the Gmail API, but it cannot parse JSON or extract specific fields like \"text\".\n\n\nThis message was sent automatically with n8n",
      "entities": [
        {
          "offset": 70,
          "length": 6,
          "type": "code"
        },
        {
          "offset": 191,
          "length": 41,
          "type": "italic"
        },
        {
          "offset": 232,
          "length": 3,
          "type": "text_link",
          "url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_9d593e1bfc8e736af9d6c0252a2d24b7f2550466563ed29fbda840b87d0b069d"
        }
      ],
      "link_preview_options": {
        "is_disabled": true
      }
    }
  },
  {
    "ok": true,
    "result": {
      "message_id": 228,
      "from": {
        "id": 7823671008,
        "is_bot": true,
        "first_name": "Gmail",
        "username": "Akh_Gemini_Bot"
      },
      "chat": {
        "id": 436761695,
        "first_name": "B",
        "username": "Robis74",
        "type": "private"
      },
      "date": 1745615894,
      "text": "I apologize, I am unable to fulfill this request. The Gmail1 tool is designed to retrieve messages from the Gmail API, but it does not have the capacity to parse JSON or extract text content.\n\n\nThis message was sent automatically with n8n",
      "entities": [
        {
          "offset": 54,
          "length": 6,
          "type": "code"
        },
        {
          "offset": 194,
          "length": 41,
          "type": "italic"
        },
        {
          "offset": 235,
          "length": 3,
          "type": "text_link",
          "url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_9d593e1bfc8e736af9d6c0252a2d24b7f2550466563ed29fbda840b87d0b069d"
        }
      ],
      "link_preview_options": {
        "is_disabled": true
      }
    }
  },
  {
    "ok": true,
    "result": {
      "message_id": 229,
      "from": {
        "id": 7823671008,
        "is_bot": true,
        "first_name": "Gmail",
        "username": "Akh_Gemini_Bot"
      },
      "chat": {
        "id": 436761695,
        "first_name": "B",
        "username": "Robis74",
        "type": "private"
      },
      "date": 1745615894,
      "text": "I'm sorry, I can't process your request. The Gmail1 tool is limited to retrieving messages from the Gmail API and doesn't have the functionality to parse JSON or extract text content.\n\n\nThis message was sent automatically with n8n",
      "entities": [
        {
          "offset": 45,
          "length": 6,
          "type": "code"
        },
        {
          "offset": 186,
          "length": 41,
          "type": "italic"
        },
        {
          "offset": 227,
          "length": 3,
          "type": "text_link",
          "url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_9d593e1bfc8e736af9d6c0252a2d24b7f2550466563ed29fbda840b87d0b069d"
        }
      ],
      "link_preview_options": {
        "is_disabled": true
      }
    }
  }
]

Information on your n8n setup
-# Debug info

core

  • n8nVersion: 1.88.0
  • platform: docker (cloud)
  • nodeJsVersion: 20.19.0
  • database: sqlite
  • executionMode: regular
  • concurrency: 5
  • license: community
  • consumerId: 00000000-0000-0000-0000-000000000000

storage

  • success: all
  • error: all
  • progress: false
  • manual: true
  • binaryMode: filesystem

pruning

  • enabled: true
  • maxAge: 168 hours
  • maxCount: 2500 executions

client

  • userAgent: mozilla/5.0 (macintosh; intel mac os x 10_15_7) applewebkit/537.36 (khtml, like gecko) chrome/135.0.0.0 safari/537.36 edg/135.0.0.0
  • isTouchDevice: false

Hello @Bakh

Without prior aggregation, the agent processes each email separately, creating fragmented messages. To solve this, you add an Item Lists Node to aggregate the Emails into 1 item before the AI ​​Agent.

Select the Aggregate Items node, then select the field that contains the body of the emails (probably text or textPlain). You can also include fields such as subject to provide context to the agent.
In Field Name for Aggregated Content, give a clear name, such as aggregatedEmails.
In Separator, use a delimiter that differentiates each email in the aggregated text, as suggested below…example:

– NEW EMAIL —
Subject: {{ subject }}
Sender: {{ from }}
Content:
{{ textPlain or text }}

The AI ​​Agent node does not need the Gmail1 tool to complete its task, because the Gmail node is already returning the emails. This may be causing confusion in the execution.

The Telegram bot needs to receive a unified summary of all emails.

I believe that once you turn all emails into 1 item, your problem will be solved.

Remember to pay attention to the names given to the variables so as not to generate an error, ok.

I hope I have helped in some way

If this suggestion solved your problem, mark my post as a solution (blue box with a check mark) so that this ongoing discussion does not distract others who want to find out the answer to the original question and click the heart. Thank you :+1:

If I understand you correctly, you want a summary of your unread emails, then the summary is sent to Telegram. I am uncertain if you want a separate summary for each email.

This workflow will create a summary for each of your unread emails.
It precedes each summary with a number followed by a period, then 2 spaces. For example: "2. ". This is done so that each of the summaries can be differentiated (for the case when there are multiple occurrences of \n this makes it easier to break them up). Note that this is done via chat input, not by the workflow (see below).

The Split Out node creates separate output for each summary. If you have 5 unread emails, this will create 5 separate summary outputs for Telegram.

If you only want a single output for all your summaries, do not bother with the Edit Field node or the Split Out node.

Important: Your chat input is important. I used the following to get the numbering done so I could safely delimit each summary: “get unread email and summarize each one. Preface each summary with a number (example: "1. ". Otherwise just output the summaries, do not comment.”

I tried putting that instruction into the System Message of the AI Agent but it seemed to ignore it. If this workflow is useful to you, you can play with the System Message to see if you can get it to work (without having to input the numbering instruction as a prompt).

I do not have a Telegram Auth so I used a Convert File node instead. In my use case a separate file would be created for each email that was summarized. Again, if you just want one summary for the total unread emails, you can delete the Edit Field and Split Out nodes AND you won’t need to give instructions for numbering.

Final thoughts: Using numerical delimiters may not always work. If your summaries happen to include something like "1. " then this workflow would consider it a delimiter. It probably makes sense to use unlikely characters instead.
Also, you can ask the agent to create separate summaries or a single summary for all of the unread emails combined, depending on your preference.

I hope I understood what you were asking. Let me know if I can give further help. If this solves your problem, please close this topic.

Take care. :slightly_smiling_face:

Do you still need more help ?