Skip to content

hey-granth/instasmith

Repository files navigation

Instagram Automation Project

This project is a comprehensive Instagram automation tool that uses AI to generate unique content, stores it, and posts it to Instagram. It can be deployed as a set of Google Cloud Functions or run locally for development and testing.

🌟 Features

  • AI-Powered Content Generation: Utilizes Perplexity AI to create engaging Instagram captions, complete with relevant hashtags and image prompts.
  • Dynamic Image Generation: Supports multiple image generation services, including Pollinations, Stable Horde, Hugging Face, and local Stable Diffusion, to create images based on AI-generated prompts.
  • Cloud & Local Storage: Saves generated images and metadata to Google Drive and tracks posts in a Firestore database.
  • Automated Posting: Posts content to Instagram based on a schedule or manual triggers.
  • Flexible Scheduling: Uses Firebase Cloud Scheduler for automated content generation and posting.
  • Manual Control: Provides HTTP endpoints for manual content generation and posting.
  • Local Development: Includes a local runner script for easy development and testing without deployment.

Project Structure

/home/granth/PycharmProjects/instagram-automation/
├───.gitignore
├───firebase.json
├───instagram_session.json
├───preview_image.jpg
├───requirements.txt
├───run_local.py
└───functions/
    ├───config.py
    ├───main.py
    ├───services/
    │   ├───image_service.py
    │   ├───instagram_service.py
    │   ├───perplexity_service.py
    │   └───storage_service.py
    └───utils/
        └───database.py

Technologies Used

  • Python: Core programming language.
  • Google Cloud Platform:
    • Firebase Functions: For serverless automation.
    • Firestore: As the database for post management.
    • Google Drive: For storing generated content.
  • Perplexity AI: For content and prompt generation.
  • instagrapi: For Instagram API interaction.
  • Pillow: For image processing.
  • python-dotenv: For environment variable management.

Setup and Installation

Prerequisites

  • Python 3.11+
  • A Google Cloud Platform project with Firebase enabled.
  • API keys and credentials for the services you intend to use (Perplexity AI, Instagram, etc.).

Installation

  1. Clone the repository:

    git clone https://github.com/hey-granth/instagram-automation.git
    cd instagram-automation
  2. Create and activate a virtual environment:

    python -m venv .venv
    source .venv/bin/activate
  3. Install the dependencies:

    pip install -r requirements.txt
  4. Set up environment variables:

    • Create a .env file in the functions directory.
    • Add the necessary environment variables to the .env file. See functions/config.py for a list of required variables.

Usage

Local Development

The run_local.py script allows you to run the automation workflow locally.

  • Generate and post content:

    python run_local.py --post
  • Generate content without posting:

    python run_local.py --generate
  • Post pending content from the database:

    python run_local.py --post-pending
  • Generate content with a specific theme:

    python run_local.py --theme "your theme"

Deployment

This project is designed to be deployed as Google Cloud Functions.

  1. Set up the Firebase CLI:

  2. Deploy the functions:

    firebase deploy --only functions

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue to discuss any changes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages