DEV Community

Eren Yarış
Eren Yarış

Posted on

I Built an AI Bot That Publishes SEO Articles Automatically — Full Code Breakdown

I Built an AI Bot That Publishes SEO Articles Automatically — Full Code Breakdown

Introduction

As a developer and entrepreneur, I'm always on the lookout for innovative ways to automate tasks and generate passive income. Recently, I built an AI bot that publishes SEO articles automatically using a combination of powerful APIs and node.js. In this article, I'll take you through the exact tech stack I used, the reasoning behind my choices, and the full automation flow with code snippets.

Tech Stack

For this project, I chose the following tech stack:

  • Groq API: For AI-generated content. I opted for Groq over OpenAI due to its generous free tier, which allows for 14,400 requests per day. This was more than sufficient for my needs, and it saved me a significant amount of money.
  • Dev.to API: For publishing articles. I chose Dev.to over a traditional blog for several reasons. Firstly, Dev.to has a high domain authority (DA 90+), which means that articles published on the platform tend to rank well on Google. Secondly, Dev.to has a large built-in audience, which increases the visibility of my articles. Finally, articles on Dev.to tend to rank in weeks, not months, which is a huge advantage over traditional blogging.
  • node-cron: For scheduling tasks. I used node-cron to schedule my bot to run at regular intervals, ensuring that new articles are published consistently.
  • nohup: For running my bot in the background. I used nohup to keep my bot running even after I closed my terminal, ensuring that it continued to publish articles without interruption.

Automation Flow

The automation flow for my bot is as follows:

  1. Article generation: My bot uses the Groq API to generate high-quality, SEO-optimized articles based on a set of predefined keywords.
  2. Article formatting: The generated article is then formatted to meet Dev.to's publishing guidelines.
  3. Article publishing: The formatted article is then published on Dev.to using the Dev.to API.
  4. Gumroad product creation: For each article, my bot creates a corresponding Gumroad product, which includes a downloadable resource related to the article.
  5. Gumroad product promotion: The Gumroad product is then promoted in the article, creating a seamless income funnel.

Code Snippets

Here are some code snippets that demonstrate the automation flow:

// Import required libraries
const { GroqClient } = require('@groq/client');
const { DevToClient } = require('devto-api');
const nodeCron = require('node-cron');
const nohup = require('nohup');

// Set up Groq API client
const groqClient = new GroqClient('YOUR_GROQ_API_KEY');

// Set up Dev.to API client
const devToClient = new DevToClient('YOUR_DEV_TO_API_KEY');

// Define article generation function
async function generateArticle(keywords) {
  const response = await groqClient.generateArticle(keywords);
  return response.data;
}

// Define article publishing function
async function publishArticle(article) {
  const response = await devToClient.createArticle(article);
  return response.data;
}

// Define Gumroad product creation function
async function createGumroadProduct(article) {
  // Create Gumroad product using Gumroad API
  const response = await gumroadClient.createProduct(article);
  return response.data;
}

// Schedule bot to run every day
nodeCron.schedule('0 0 * * *', async () => {
  // Generate article
  const article = await generateArticle('your-keywords');

  // Publish article
  const publishedArticle = await publishArticle(article);

  // Create Gumroad product
  const gumroadProduct = await createGumroadProduct(publishedArticle);
});
Enter fullscreen mode Exit fullscreen mode

Results

After building and deploying my bot, I was able to generate 35 high-quality articles and create 10 corresponding Gumroad products. The best part? The entire process was fully automated, requiring minimal intervention from me.

Income Funnel

The income funnel for my bot is as follows:

  1. Google search: Users search for keywords related to my articles on Google.
  2. Dev.to article: Users click on my article on Dev.to, which ranks highly on Google due to its high DA and SEO optimization.
  3. Gumroad product promotion: Users are promoted to a Gumroad product related to the article, which they can purchase for a fee.

Honest Timeline

It took me approximately 2 weeks to build and deploy my bot. I started seeing results within 2-6 weeks, with my articles ranking on Google and generating sales on Gumroad.

Conclusion

Building an AI bot that publishes SEO articles automatically has been a game-changer for my online business. With the right tech stack and automation flow, I've been able to generate high-quality content, promote products, and earn passive income with minimal intervention. If you're interested in learning more about AI-powered passive income systems, be sure to follow @_incomexempire and check out this article for more information.


🔗 Related Articles

🛒 Get the Full Toolkit

Top comments (0)