AI Email Composer Solution

AI Email Composer: Complete Lab Solution

Explore the full solution to the AI Email Composer lab, including the full workflow, configuration steps, and answers.

Email tool used in this version: Gmail (Send a message in Gmail)

How to Access AIX Workspace

Step A

Create your account

  1. Open your browser and go to www.aixworkspace.net.
  2. On the home page, click الدخول للمنصة.
  3. You will land on a page titled الدخول للمنصة. Scroll down a little until you see Create your AIX Workspace Account.
  4. Fill in your الاسم الكامل و عنوان البريد الإلكتروني.
  5. Under I’m registering as, choose فرد (not Company / Organization).
  6. Click إنشاء حسابي.
The AIX Workspace account creation form with Full name, Email address and Individual selected
The account creation form — enter your name and email, then select Individual.
Step B

Get your credentials from email

After you create the account, you will receive an email from register@aixworkspace.net. This email gives you three sets of credentials:

n8n login
Sign-in URLLogin emailPassword
PostgreSQL database
HostPortDatabaseUsernamePassword
AI model
Base URLAPI key
An example of the welcome email with your n8n, PostgreSQL, and AI model credentials. Your own values will be different — keep them private.
Step C

Log in to n8n

  1. In the email, find the n8n section and click the Sign-in URL.
  2. Log in using the email and password from that same email.
  3. You are now on the n8n dashboard.
Step D

Verify your credentials inside n8n

Your Credentials are already configured inside n8n please verify. On the dashboard, open Credentials and add two credentials using the details from your email:

  1. Your PostgreSQL database credentials.
  2. Your AI model credentials (Base URL and API key).
Why this matters: Once these two credentials are saved, your workflow will connect to them automatically in Part 2.

Build Your First Workflow: Email Dictation Model

In this part you will build a simple automation. You talk to an AI agent in chat, and it writes and sends an email for you. The workflow has four pieces: a chat trigger, an AI agent, a memory, and an email tool.

Chat trigger
AI agent
Memory
Email tool (Gmail)
Step 1

Create the workflow

  1. Click Create Workflow. You will see an empty canvas.
  2. Name the workflow Email Dictation Model.
Step 2

Add the chat trigger

  1. Click the plus (+) button in the middle of the canvas, or at the top-right.
  2. Select the Chat Trigger node — it is called When chat message received.
Step 3

Add the AI Agent

  1. Click the plus (+) after the trigger and add the وكيل الذكاء الاصطناعي node.
Step 4

Set the Chat Model

  1. Under the AI Agent, click Chat Model and select OpenAI Chat Model.
  2. Your credentials are already filled in (you set the AI model credential in Part 1).
  3. Open the node and select the model qwen3-8-27b.
Step 5

Set the Memory

  1. Under the AI Agent, click Memory and select Postgres Chat Memory.
  2. Its credentials are already filled in (your PostgreSQL credential from Part 1).
Step 6

Add the email tool (Gmail — Send a message in Gmail)

6.1 Add the Gmail tool
  1. Under the AI Agent, click Tool (the + under Tool) and search for Gmail.
  2. Select the Gmail Tool. Choose the action Send a message. The node will appear on the canvas named Send a message in Gmail.
6.2 Connect your Gmail account (one-time setup)

Because n8n is self-hosted, “just connect your account” will not work here. You first make your own Google login (a Client ID and a Client Secret), then connect. This is a one-time setup.

  1. Create the OAuth client in Google Cloud. Go to console.cloud.google.com/auth/clients. Click Create client, choose Web application, and give it a name (for example n8n).
    Google Cloud Clients screen showing Create client and Web application
    Google Cloud → Clients. Click Create client and choose Web application.
  2. Create the credential in n8n and copy the Redirect URL. In n8n, open the Send a message in Gmail node. Under Credential to connect with, click Create new credential and choose Gmail OAuth2 API. Copy the OAuth Redirect URL shown at the top.
    n8n Gmail OAuth2 credential fields for Client ID and Client Secret
    The n8n Gmail credential — copy the OAuth Redirect URL, and later paste your Client ID and Client Secret here.
  3. Paste the Redirect URL in Google. Open your new client in Google. Under Authorized redirect URIs, click Add URI, paste the URL you copied from n8n, and click يحفظ.
    Google OAuth client page with Authorized redirect URIs and Client ID
    Paste the redirect URL under Authorized redirect URIs. The Client ID is on this same page.
  4. Copy the Client ID and Client Secret. The Client ID is on the client page (see the previous screenshot). The Client Secret is in the Client secrets section. Google shows the secret only when it is created, so copy it right away. If you missed it, click Add secret to create a new one.
    Google Cloud OAuth Client secrets section with masked secrets
    Client secrets — copy the Client Secret (you see it only when it is created).
  5. Paste them into n8n. In the n8n credential window, paste the Client ID و Client Secret into their fields.
  6. Add yourself as a test user. In Google, go to Audience → Test users → Add users, and add your own Gmail address. Without this, sign-in will be blocked.
    Google Cloud OAuth Audience Test users screen
    Audience → Test users — add your own Gmail as a test user, or sign-in will be blocked.
  7. Enable the Gmail API. In Google Cloud, open APIs & Services → Library, search for Gmail API, and click Enable (direct link: console.cloud.google.com/apis/library/gmail.googleapis.com). Make sure your own project is selected at the top.
  8. Sign in with Google. Back in n8n, click Sign in with Google and allow access.
    Important — permissions: On the Google permission box, tick Read and Compose only. Do NOT tick the option that can permanently delete emails.
  9. Save the credential. When n8n shows the account as connected, save and close the credential window.
6.3 Configure the Gmail node
  1. Leave the Tool Description set to Automatic.
  2. Set Resource to Message و Operation to Send.
  3. For To, let the وكيل الذكاء الاصطناعي decide (use the option to let the model define this parameter).
  4. Let the موضوع and the Message be written by the agent as well.
  5. Set Email Type to Text.
  6. Under Options, you can switch off Append n8n attribution so the email does not carry the n8n footer.

Note: you do not enter a “From” address. Gmail sends the email from the Google account you connected in step 6.2.

The completed n8n workflow showing Chat Trigger, AI Agent, OpenAI Chat Model, Postgres Chat Memory and Send a message in Gmail
The finished workflow: Chat Trigger → AI Agent, with Chat Model, Memory, and the Gmail tool connected.
Step 7

Test the workflow

  1. Open the محادثة panel at the bottom-left of the canvas.
  2. Type a message like “Hello, send an email …” and watch the agent write and send it.
You’re done! If anything does not work, raise your hand and a mentor will help you check your nodes and credentials.