Skip to content

CLI application POC for using AI to create MJ resources

Notifications You must be signed in to change notification settings

MediaJel/mediajel-mini

Repository files navigation

Mediajel Mini - Marketing Campaign Management CLI

A command-line interface (CLI) application for managing marketing campaigns, audiences, and geographical targeting using OpenAI's GPT-4 for natural language processing.

Features

  • Natural language campaign management
  • Create and manage marketing campaigns
  • Define and manage target audiences
  • Set up geographical targeting
  • Interactive CLI interface
  • PostgreSQL database integration
  • OpenAI GPT-4 powered assistant

Prerequisites

  • Node.js (v22 or higher)
  • PostgreSQL database
  • OpenAI API key
  • Bun runtime

Installation

  1. Clone the repository:
git clone <repository-url>
cd mediajel-mini
  1. Install dependencies:
bun install
  1. Set up environment variables:
cp .env.example .env

Update the .env file with your credentials:

DATABASE_URL="postgresql://postgres:postgres@localhost:5432/myapp?schema=public"
OPENAI_API_KEY=your_openai_api_key_here
  1. Start the PostgreSQL database using Docker:
docker-compose up -d
  1. Run database migrations:
bunx prisma migrate dev

Usage

Start the CLI application:

bun start

The CLI will present you with a prompt where you can interact with the marketing assistant using natural language.

Example commands:

  • "Create a campaign named 'Summer Sale'"
  • "Add an audience targeting young professionals"
  • "Set up geographical targeting for California"
  • "Pause the 'Summer Sale' campaign"

Project Structure

mediajel-mini/
├── prisma/                  # Database schema and migrations
├── src/
│   ├── tools/              # Tool implementations
│   │   ├── audience-tools.ts
│   │   ├── campaign-tools.ts
│   │   └── geo-target-tools.ts
│   ├── chatbot.ts          # OpenAI integration
│   └── index.ts            # CLI entry point
├── docker-compose.yml      # Docker configuration
└── package.json

Implementation Details

Database Schema

The application uses Prisma ORM with PostgreSQL and includes the following models:

  • Campaign: Marketing campaign details
  • Audience: Target audience definitions
  • GeoTarget: Geographical targeting information

Tools

  1. Campaign Tools:
  • Create campaigns
  • Update campaign status
  • Delete campaigns
  • Retrieve campaign information
  1. Audience Tools:
  • Create audience definitions
  • Update audience criteria
  • Associate audiences with campaigns
  • Delete audience definitions
  1. Geo-Target Tools:
  • Create geographical targeting
  • Update targeting regions
  • Associate regions with campaigns
  • Delete geographical targeting

OpenAI Integration

The application uses GPT-4 to:

  • Parse natural language commands
  • Convert user intent into actions
  • Provide human-like responses
  • Handle error cases gracefully

Development

Adding New Features

  1. Define new models in prisma/schema.prisma
  2. Create migrations:
bunx prisma migrate dev --name feature_name
  1. Implement new tools in src/tools/
  2. Update the chatbot to handle new capabilities

Testing

Run the test suite:

bun test

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

MIT

Support

For support, please open an issue in the repository.

About

CLI application POC for using AI to create MJ resources

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published