# Email Automation via General AI Agents (with Base row DB + Slack)

### **1. Use Case Overview**

<mark style="background-color:yellow;">**Objective:**</mark>\
Enable support or operations teams to automate the handling of incoming emails by parsing, categorizing, and responding to them using a Soika AI Agent. The agent connects with a Base row database to log and manage requests and sends instant notifications or approvals via Slack.

<mark style="background-color:yellow;">**Primary Actors:**</mark>

* Email Sender (Customer/Internal Staff)
* Soika Email Automation Agent
* Base row&#x20;
* Slack (Real-time Notifications/Approvals)

<mark style="background-color:yellow;">**Target Platforms:**</mark>

* Gmail/Outlook (Incoming Email)
* Base row (Task DB + Contact Directory)
* Slack (Real-time alerts and updates)

### **2.&#x20;**<mark style="background-color:yellow;">**Business Value Proposition**</mark>

The Soika AI Email Automation Agent helps streamline communication workflows by reading and understanding email contents, logging structured data into a database, and automating team alerts. This reduces manual effort, eliminates bottlenecks, and ensures prompt action.

#### **Benefits:**

* 90% reduction in manual email triaging
* Tasks auto-logged into Base row
* Automated tagging and categorization of requests
* Real-time Slack notifications to the right stakeholders
* Supports structured and unstructured email formats

### **3. Step-by-step Process**

### **A. AI Agent Creation**

| Steps                 | Instructions                                                                                                                                                                                                                                                                                                                            |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Step 1                | User opens Soika Mockingjay platform with Login ID and Password                                                                                                                                                                                                                                                                         |
| Step 2                | <p>Ask Soika to Create an AI Agent based on the use case with Natural Language Prompt </p><p>Example : “Create an Email Analyzer Agent which is a specialized assistant for handling incoming emails, classifying their urgency, and routing replies and summaries appropriately. The emails would be classified based on urgency.”</p> |
| <p> </p><p>Step 3</p> | <p> The Agent is created in the left panel : General Email Analyzer Agent</p><p>Choose your LLM Model from the Agent in <strong>Edit AI-> AI Model-> llama3.3</strong></p>                                                                                                                                                              |

<figure><img src="/files/eTsUs50zSJmDBVqp6laQ" alt=""><figcaption><p>Step 2</p></figcaption></figure>

<figure><img src="/files/KLogd5hTkjS1DEQUFEVp" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/ZbkgwuHN04b2IvJ70Rue" alt=""><figcaption><p>Email Analyzer Automation Agent</p></figcaption></figure>

### **B. Tool Integration (Email + Baserow + Slack)**

| Steps  | Instructions                                                                                                           |
| ------ | ---------------------------------------------------------------------------------------------------------------------- |
| Step 4 | Connect the AI Agent with the Default Tools under the Edit AI -->Tools-->default Tools Section  -->  Email  Tools      |
| Step 5 | Connect the AI Agent with the Default Tools under the Edit AI -->Tools-->default Tools Section  -->  Base Row DB Tools |
| Step 6 | Connect the AI Agent with the Default Tools under the Edit AI -->Tools-->default Tools Section -->  Slack Tools        |

### **Connect Tools**

### **A. Email Tool**

&#x20;       Email: <https://developers.google.com/workspace/gmail/imap/imap-smtp>

&#x20;       Authorize using Gmail IMAP/SMTP (<https://myaccount.google.com/apppasswords>)

<figure><img src="/files/l3GczUPOq86SDF2Fua7r" alt=""><figcaption></figcaption></figure>

### **B. Base row DB**

* Create a Table  as mentioned below with the  API URL [Grid - Email\_Analyzer | Baserow](https://baserow.io/database/246855/table/585845/1090589)
* **Create a Table on the baserow\.io**:  <https://baserow.io/database/246844/table/585819/1090538>(**e.g. Table I**)
* **For Authorization in Soika Default Tools  Use API URL**: <https://api.baserow.io>

### **Example of Creation of Table I in Base Row DB**

<figure><img src="/files/BEh69MhgE7EsfWm6TcKB" alt=""><figcaption><p>TABLE I (Left click on Email Analyzer to get Table ID :585819)</p></figcaption></figure>

<figure><img src="/files/0dbSMUhPfMyALBq4FMHU" alt=""><figcaption></figcaption></figure>

### **C. Slack Integration**

Enable Slack Bot Token and Webhooks via Slack Developer Console

* **Step-by-Step**: Get Slack Incoming Webhook URL

**Step 1**: Go to Slack App Creation

1. Visit: <https://api.slack.com/apps>
2. Click "Create New App"
3. Choose "From scratch"
4. Give it a name and choose the Slack workspace
5. Click "Create App"

&#x20;

**Step 2**: Enable Incoming Webhooks

1. In the left menu, go to "Incoming Webhooks"
2. Click the toggle to "Activate Incoming Webhooks"

&#x20;

&#x20;**Step 3:** Create Webhook URL

1. Scroll down and click "Add New Webhook to Workspace"
2. Select the channel where you want to post messages
3. Click "Allow"
4. You’ll be redirected to the app page with your Webhook URL

* **For Slack**: <https://api.slack.com/apps>

  <https://app.slack.com/client/T091FAZAK46/C091FAZJ2Q6>

<figure><img src="/files/cgzWLkUbGtq1LSmmXMXY" alt=""><figcaption></figcaption></figure>

### &#x20;**Enable & Manage Tools**

Go to `Tools → Default Tools` and enable:

* Email -   Enable the Function -Send Email
* Base row -Enable the Function-Get Rows
* Slack

| Steps                          | Instuctions                                                                                                                           |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
| Step 7 :Enable and Mange Tools | <p></p><p>Once Authorized, Enabled the tools with the help of <strong>Tools-> Tools Manager - Default -Toggle the button</strong></p> |

<figure><img src="/files/nCBU423lXGuTZdcRVPbS" alt=""><figcaption><p>Enable the functions w.r.t Email, Slack, Base Row DB</p></figcaption></figure>

### Example of System Instructions

You are Email Triage Bot, a specialized assistant for handling incoming emails, classifying their urgency, and routing replies and summaries appropriately. Follow these rules exactly:

&#x20;1\. Ingest incoming email.

&#x20;  \- You receive each email with three pieces of data:

&#x20;    • the sender’s address&#x20;

&#x20;    • the original subject line&#x20;

&#x20;    • the full email body text&#x20;

&#x20;  \- Always preserve these original values.

&#x20;2\. Classify the email content.

&#x20;  \- Read the email body and assign one of four labels:&#x20;

&#x20;    • urgent&#x20;

&#x20;    • critical&#x20;

&#x20;    • issues&#x20;

&#x20;  \- Use clear criteria—keywords, tone, or deadline language—to decide:&#x20;

&#x20;    • “urgent” for items that require response within 24 hours&#x20;

&#x20;    • “critical” for severe-impact requests needing action within 1 hour&#x20;

&#x20;    • “issues” for bug reports, errors, or downtime notifications&#x20;

&#x20;3\. Handle general emails.

&#x20;  \- If you decide the message is “general,” compose a reply that:

&#x20;    – is addressed back to the original sender&#x20;

&#x20;    – uses “Re: \[original subject]” as the subject line&#x20;

&#x20;    – has the body text:&#x20;

&#x20;      “Thank you for your email. We have received your message and will contact you shortly.”&#x20;

&#x20;  \- Do not look anything up or send notifications elsewhere.

&#x20;4\. Handle urgent, critical, or issues emails.

&#x20;  \- For any of these three, first invoke Get Rows from the table id 585819 by supplying the label. That tool returns records containing the priority row and email row content.

&#x20;  \- Then compose a reply that:

&#x20;    – is addressed to the email address returned by the lookup&#x20;

&#x20;    – uses “\[LABEL] Re: \[original subject]” as the subject line (where LABEL is urgent, critical, or issues)&#x20;

&#x20;    – has a body containing a 2–4-sentence summary of the original message, followed by “Please take the necessary action.”&#x20;

&#x20;  \- Send that reply via your email-sending tool.

&#x20;5\. Notify Slack.

&#x20;  \- If the message was labelled urgent, critical, or issues, also post to Slack:

&#x20;    – in the #triage-notifications channel&#x20;

&#x20;    – with text that begins with a bolded label, then the original subject line, then the same 2–4-sentence summary.

&#x20;

General guidelines:

\- Always generate both a subject and a body for every outgoing email.

\- Always enclose the final recipient address in quotation marks.

\- Keep your summaries concise and professional.

\- Never perform any actions other than classification, lookup, email reply, and Slack notification.

\- Begin each new request by reading the incoming data, then follow these steps in order. Never skip the classification step.

### Example of Agent Successfully sending Emails based on Classification

<figure><img src="/files/XvcsfuyFvAKAuW7PWsHr" alt=""><figcaption><p>Email Sent to the respective mail ID</p></figcaption></figure>

<figure><img src="/files/UL9g3iQY2eP7jmIjzRul" alt=""><figcaption><p>Notification in Slack</p></figcaption></figure>

<figure><img src="/files/PmHri4dSab6BegbXvF9t" alt=""><figcaption></figcaption></figure>

###


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://soika-labs.gitbook.io/soika-mockingjay/use-cases/email-automation-via-general-ai-agents-with-base-row-db-+-slack.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
