An automated content generation system for Ghost blogs that fetches AI news, translates them to French, and publishes them automatically using OpenAI's GPT-4o.
- 🔄 Automatically fetches the latest AI news using NewsAPI
 - 🤖 Generates high-quality French articles using OpenAI's GPT-4o
 - 🖼️ Adds relevant featured images from Unsplash
 - 📝 Saves articles locally as markdown files
 - 🚀 Publishes directly to your Ghost blog
 - ⏰ Runs on a schedule (default: twice daily at 7 AM and 7 PM)
 - 🏷️ Automatically adds relevant tags
 - 📊 Includes error handling and logging
 
- Node.js (v14 or higher)
 - A Ghost blog with Admin API access
 - API keys for:
- OpenAI
 - NewsAPI
 - Unsplash
 - Ghost Content API
 - Ghost Admin API
 
 
- Clone the repository:
 
git clone https://github.com/Decryptu/ghost-autoblogger-bot.git
cd ghost-autoblogger-bot- Install dependencies:
 
npm install- Create a 
.envfile in the root directory: 
OPENAI_API_KEY=your_openai_key
GHOST_API_URL=your_ghost_url
GHOST_CONTENT_API_KEY=your_ghost_content_key
GHOST_ADMIN_API_KEY=your_ghost_admin_key
UNSPLASH_ACCESS_KEY=your_unsplash_key
NEWS_API_KEY=your_news_api_keyRun the bot immediately:
node bot.js --runFor production, it's recommended to use PM2:
- Install PM2:
 
npm install -g pm2- Start the bot:
 
pm2 start ecosystem.config.js- Monitor the bot:
 
pm2 logs ghost-autobloggerEdit config.js to customize:
- OpenAI model
 - Article prompt
 - Schedule timing
 - Default image URL
 - Author ID
 
├── bot.js              # Main bot logic
├── config.js           # Configuration settings
├── ecosystem.config.js # PM2 configuration
├── .env               # Environment variables
└── generated_articles/ # Local storage for generated articles
Articles are saved in two places:
- Locally in the 
generated_articlesfolder as markdown files - Published directly to your Ghost blog
 
Edit CRON_SCHEDULE in config.js. Default is twice daily (0 7,19 * * *).
Edit ARTICLE_PROMPT in config.js to change the tone, style, or format of generated articles.
Modify the tags array in the publishToGhost function in bot.js.
The bot includes comprehensive error handling for:
- API failures
 - Network issues
 - Content generation errors
 - Image fetching issues
 - Publishing problems
 
All errors are logged to the console with detailed messages.
- Fork the repository
 - Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
 
MIT License - see the LICENSE file for details
For support, please open an issue in the GitHub repository.
- OpenAI GPT-4o for content generation
 - Ghost for the amazing blogging platform
 - NewsAPI for news sources
 - Unsplash for images