I Just Built An AI Agent Clone Of Myself (n8n)

Jono CatliffAbout 5 min readMar 30, 2025Watch original
THE SUMMARYAI-generated

AI Agent Clone: A Detailed Breakdown

Key Concepts:

  • AI Agent
  • Voice Cloning
  • Automation
  • Telegram Integration
  • NAND
  • 11 Labs
  • OpenAI
  • HTTP Request
  • JSON Formatting
  • System Prompt

1. Introduction

The video demonstrates how to create an AI agent clone of the speaker, Jonno, capable of responding to messages via Telegram using a cloned voice. The process involves integrating NAND for automation, 11 Labs for voice cloning, and OpenAI for transcription and AI reasoning.

2. Demonstration

Jonno showcases the AI agent by sending an audio message to it via Telegram. The agent processes the message and responds with a voice that sounds similar to Jonno's, even addressing him as "Count Jonno."

3. Blueprint Download

The blueprint for this project is available for free download in the video description. Users can import the file into NAND to get started.

4. Technology Stack

  • NAND: Powers the automation and AI agent logic.
  • 11 Labs: Generates the voice clone.
  • Telegram: Used as the messaging platform for interaction with the AI agent.
  • OpenAI: Used for transcribing audio messages and for the AI agent's reasoning.

5. Community Invitation

Jonno promotes his community, which offers additional blueprints, courses, and weekly group calls for tech and business-related assistance.

6. Workflow Setup in NAND

6.1. Telegram Trigger

  • Trigger: "On Message" from Telegram. This initiates the workflow when a new message is received.
  • Access Token: Required to connect NAND to Telegram. Obtained by interacting with BotFather in Telegram.
    • Start a conversation with BotFather.
    • Use the /newbot command to create a new bot.
    • Name the bot and create a unique username ending in "bot."
    • Copy the provided access token and paste it into the NAND Telegram connection settings.
  • Testing the Connection: Send a message to the newly created bot to verify the connection.

6.2. Switch Statement

  • Purpose: Routes messages based on whether they are audio or text.
  • Logic:
    • Audio Path: If the message is audio (i.e., the "text" field does not exist), it follows this path.
    • Text Path: If the message is text (i.e., the "text" field exists), it follows this path.
  • Text Field Creation: In the text path, an "Edit Field" module creates a new field called "text" with the value of the incoming text message.

6.3. Audio Processing (Audio Path)

  • Get File (Telegram): Downloads the audio file using the file ID from the Telegram message.
  • Transcribe a Recording (OpenAI): Converts the audio to text using OpenAI's transcription service.
    • Requires an OpenAI API key.
    • Minimum $5 credit needed on the OpenAI account.

6.4. Merge Step

  • Purpose: Combines the text from either the audio transcription or the direct text message into a single "text" field.
  • Key: "text" is used as the common key for merging.

6.5. AI Agent

  • Brain: OpenAI is selected as the AI reasoning engine.
  • Memory: Configured to remember past messages.
  • Session ID: Set to the Telegram chat ID to maintain context for each conversation.
  • JSON Chat Input: Modified to correctly map the incoming text from Telegram.
    • The default prompt is designed for NAND's native chat widget, so it needs to be adjusted.
    • The "text" field from the merge step is used as the input to the AI agent.
  • System Prompt: A system prompt is added to instruct the AI agent on its role and persona (e.g., "Your helpful assistant named Jonno...").

6.6. Text-to-Speech (11 Labs)

  • HTTP Request: Since NAND doesn't have a native 11 Labs integration, an HTTP request module is used.
  • API Endpoint: The 11 Labs "Create Speech" endpoint is used to convert the AI agent's response to audio.
  • Method: POST request.
  • Headers:
    • Content-Type: application/json
    • xi-api-key: YOUR_API_KEY (Replace with your 11 Labs API key)
  • Body (JSON):
    • text: "The text to be converted to speech"
    • model_id: "eleven_monolingual_v1" (Example model ID)
    • voice_settings: { stability: 0.5, similarity_boost: 0.5 } (Example voice settings)
  • Voice ID: The unique ID of the cloned voice from 11 Labs is included in the API endpoint URL.

6.7. Send Audio (Telegram)

  • Action: Send an audio file to the Telegram chat.
  • Chat ID: Retrieved from the initial Telegram trigger.
  • Binary File: The audio data from the 11 Labs HTTP request is used as the binary file.
  • Title: A filename is assigned to the audio file (e.g., "data").

7. 11 Labs Voice Cloning

  • Account Requirement: A paid 11 Labs plan (e.g., Starter) is likely required for voice cloning.
  • Voice Creation:
    • Use the "Instant Voice Clone" feature.
    • Record audio samples or upload existing audio files.
    • Longer and more diverse audio samples improve voice quality.
  • API Key: Obtain the API key from the 11 Labs settings.

8. JSON Formatting and Troubleshooting

  • JSON.stringify(): Used to convert JSON data into a string, which is necessary when dealing with special characters or line breaks in the text.
  • Double Quotes: Ensure that the JSON is properly formatted and that there are no unnecessary double quotes.
  • Error Handling: JSON validity errors can occur due to incorrect formatting, special characters, or incorrect data types.

9. Conclusion

The video provides a detailed guide on creating an AI agent clone using NAND, 11 Labs, and OpenAI. It covers the entire workflow, from setting up the Telegram trigger to configuring the AI agent and generating voice responses. The speaker emphasizes the importance of proper JSON formatting and provides troubleshooting tips for common errors. The final result is a functional AI clone capable of engaging in conversations via Telegram using a personalized voice.

AI summaries can miss context or contain errors. Check important details against the original video.

Go a little deeper.

Have a question about this video? Load its transcript to open the video chat.