Organizing emails is a task most people have to deal with every day, but AI has made this mundane task so much easier and more efficient. With the help of Levity’s email import tools and Flows integrations, your inbox can bet set up to smart-tag and organize your emails in a matter of minutes.

In this article, we will guide you through the steps of importing your own email data into an AI Block, and linking that up to your email provider.
Step 1: Create the AI Block and import your data
First we need to prepare an AI Block and train it on our data, so it knows what to look for. Head over to AI Blocks on the left menu, and then click Create AI Block and select Text Classifier. Give your Block a name, and then click the Add text button.

When you select the Flow you want to connect, it will take you through a series of options (seen in the above gif).
Lets break these steps down…
The first page asks you to choose where you want to pull your data from. If you have already extracted your emails (some mail providers have export options), you can choose to upload a spreadsheet of that data by clicking on Import Spreadsheet. We’re going to choose the Gmail option, as this is a smart and easy way to pull your existing emails right from the source.

You’ll need to give Gmail permission to let Levity pull email data, so the next page requires working through some authentication steps. Follow the steps below:

The next screen asks you about what you’d like to import, and how the labels should be applied as the data is added to your Levity block (you are free to adjust these after the import if you change your mind).
The top option is for the number of emails you’d like to import.
The optional Filter option is to specify a subset of your mailbox to import from, such as a particular label. You can leave the default value in there if you are unsure.
The final option is how you’d like things labeled. You have a few options:
Emails only (label manually after import)
This puts all the emails into an unassigned folder ready for you to manually categorize one-by-one. Use this if you’d prefer to go look at each email separately to decide how to label them.
Emails + one specific label for all emails
This puts everything under a single label. Use this if you’re only importing a particular subset of an inbox and want them to be in a certain folder together.
Emails + list of target labels used for auto-labeling [beta]
This uses a pre-defined list of labels and smart-categorizes your emails accordingly. Use this if you’d like standard inbox management with the most commonly used labels.
Emails + let Levity's AI suggest the labels [beta]
This is the most custom option, as it detects common themes in your email and formulates the labels accordingly. Use this if you’d like AI to take full control of your inbox management.

One you have configured all your settings, click Finish. Note: The importer takes around 1 second per email to import data to Levity. When you finish setup, you will see a notification letting you know importing has started successfully. This is the perfect time to go make a cup of coffee, then refresh the page one you’re back.
Step 2: Make adjustments to the training data before training [Optional]
Blocks can be added to and edited as needed. For example, if you don’t have enough examples of a certain label, you can always source and import more before moving on to training your block.
To add more data, click the Add text button, choose your import option, and follow the prompts.

Step 3: Train your model
Don’t worry, this step is one of the easiest in the whole process! When you’re ready to train your new Block on the data you just added, click the Train AI Block button:

You will see a pop-up confirming that you wish to proceed - click Start Training. You will see a timeline of the training, along with a time estimate, and you’ll receive an email when this process has completed:

Step 4: See a sample prediction on the Test tab
With training complete, you should now see the Test tab enabled. Head over to that page and type in some sample text to see how your Block will perform.

Step 4: Connect your Block to your email using Flows
Click the Connect tab and click the button next to “Connect to a Flow template”. This will open another pop-up wizard, where you can choose your trigger (the action that drives the prediction).
In this scenario we want to make a prediction when we receive a new email in Gmail, so we’ll choose the Gmail to Gmail option.

When you select the Flow you want to connect, it will take you through a series of options (seen in the above gif).
Lets break that down…
The next page will ask you to choose your AI Block. Select the Block you wish to connect to the Flow, and click Next:

On the next screen you will be asked to authenticate your Gmail account - this is to allow access to connect to your emails. We use a service called Tray.io as our trusted integration provider for this. Click Next when done.
The next screen allows you to filter the emails classified by Levity, by using Gmail's in-built filter operators. For example, if you only want to send emails from your inbox through your AI Block, you'd type in:inbox in this area. If you're unsure, leave this blank. Click Next.

The final step in the process is to match the labels in Levity to the Gmail labels you want to map them to. In this example, we trained our AI Block on similar label names to make it easy to match them:

You can click Finish in the bottom right corner of the popup when done with your mapping. Congratulations, you just set up a Flow! Now one final crucial step... turn it on!

Step 5: Run a test

Send a quick email to yourself (similar to how you used the Test tab) and wait to see the email show up in your inbox and get labeled automatically.
Need some help?
We’re available to provide advice, answer questions, and talk through setup options whenever you’re ready. Click here to read more about getting in touch.