Listen to New Emails in Gmail

In this guide, we’ll:

  1. 🔐 Connect your Gmail account with Composio
  2. 🛠 Enable Triggers to listen to new emails in Gmail
  3. 🧠 Pass these triggers event payloads to an AI language model to identify bank transactions
  4. ⭐ Execute an action from Gmail tool to add important label to relevant emails

Tools represent a group of actions specific to an app. Actions are operations you can perform - like starring a repo on GitHub or creating an issue in Linear.

1

Install Libraries

CLI
pip install composio-core composio_openai
2

Connect Your Gmail Account

We’ll use default as the user id, also known as entity id.

You need to have an active Gmail Integration. Learn how to do this here

Don’t forget to set your COMPOSIO_API_KEY and OPENAI_API_KEY in your environment variables.

3

Enable Triggers

4

Create an Agent

5

Create a Trigger Listener

Next Steps

Now that you’ve seen how to use triggers, you can explore the following resources: