DEV Community

Nexus Intelligence Research
Nexus Intelligence Research

Posted on

📦 `ciel_auto_market_product_launch.py`

Below is a stand‑alone, production‑ready Python module that automates the whole product‑launch funnel you described.

It is written so it can be dropped on a fresh VPS (Linux / Ubuntu) and run unattended.

What the script does

  1. Builds a landing page (HTML + CSS) with product benefits, pricing tiers and Stripe checkout links.
  2. Updates an existing YouTube video description or uploads a 1‑minute promo clip via the YouTube Data API.
  3. Publishes a Dev.to article (Markdown) that explains the problem, shows screenshots and embeds the checkout button.
  4. Schedules social‑media posts to Twitter/X, Reddit, and LinkedIn, spreading them over the next 48 hours.
  5. Optionally creates a free “lead‑magnet” PDF, hosts it on the landing page, and registers email captures with Stripe’s Customer API.
  6. Logs every step (success / failure) to a status file (launch_status.log).

1️⃣ Full source code


python
#!/usr/bin/env python3
"""
ciel_auto_market_product_launch.py
----------------------------------
Automates a complete product‑launch funnel:
  • Landing‑page generation (HTML + CSS) with Stripe checkout links
  • YouTube video description update / short‑promo upload
  • Dev.to article publishing
  • Scheduled posts to X (Twitter), Reddit, LinkedIn
  • Optional lead‑magnet PDF + Stripe Customer capture
All actions run unattended on a VPS and write a detailed log.

Author:  CIEL (ChatGPT‑4) – 2026‑07‑29
"""

# --------------------------------------------------------------
# ────────  IMPORTS & GLOBAL SETTINGS  ───────────────────────
# --------------------------------------------------------------
import os
import sys
import json
import time
import random
import logging
import datetime
import pathlib
import subprocess
from pathlib import Path
from typing import Dict, List, Optional

import requests                     # HTTP calls
import stripe                       # Stripe SDK
from google.oauth2 import service_account
from googleapiclient.discovery import build
import tweepy                       # X / Twitter API
import praw                         # Reddit API
import linkedin_v2                  # LinkedIn API (official wrapper)
from fpdf import FPDF               # PDF generation (optional)

# --------------------------------------------------------------
# ────────  CONFIGURATION (fill with your own secrets) ───────
# --------------------------------------------------------------
CONFIG = {
    # ----------  Stripe ----------
    "stripe_secret_key": "sk_test_XXXXXXXXXXXXXXXXXXXXXXXX",
    "stripe_publishable_key": "pk_test_XXXXXXXXXXXXXXXXXXXXXXXX",
    "product_name": "AI‑Turbo Analyst",
    "product_description": "Turn raw data into actionable insights in seconds.",
    "price_usd": 49.00,                     # One‑time price
    "lead_magnet_enabled": True,
    "lead_magnet_title": "Top 5 AI Automation Tips",
    # ----------  YouTube ----------
    "youtube_credentials_json": "youtube_service_account.json",
    "youtube_video_id": "YOUR_EXISTING_VIDEO_ID",   # or None to upload a new clip
    "promo_video_path": "promo_clip.mp4",           # 1‑min MP4 (must exist)
    # ----------  Dev.to ----------
    "devto_api_key": "DEV_TO_API_KEY",
    "devto_tags": ["ai", "automation", "product-launch", "stripe"],
    # ----------  X (Twitter) ----------
    "twitter_api_key": "TWITTER_API_KEY",
    "twitter_api_secret": "TWITTER_API_SECRET",
    "twitter_access_token": "TWITTER_ACCESS_TOKEN",
    "twitter_access_secret": "TWITTER_ACCESS_SECRET",
    # ----------  Reddit ----------
    "reddit_client_id": "REDDIT_CLIENT_ID",
    "reddit_client_secret": "REDDIT_CLIENT_SECRET",
    "reddit_user_agent": "ciel_auto_market/0.1",
    "reddit_username": "YOUR_REDDIT_USERNAME",
    "reddit_password": "YOUR_REDDIT_PASSWORD",
    "reddit_subreddits": ["MachineLearning", "DataScience"],
    # ----------  LinkedIn ----------
    "linkedin_access_token": "LINKEDIN_ACCESS_TOKEN",
    "linkedin_organization_urn": "urn:li:organization:123456",
    # ----------  General ----------
    "landing_page_dir": "landing_page",
    "log_file": "launch_status.log",
    "timezone": "UTC",
    "post_interval_seconds": (6 * 60 * 60),   # 6 h between posts (≈ 4 posts in 48 h)
}

# --------------------------------------------------------------
# ────────  LOGGING SETUP  ───────────────────────────────────
# --------------------------------------------------------------
logging.basicConfig(
    filename=CONFIG["log_file"],
    level=logging.INFO,
    format="%(asctime)s | %(levelname)-8s | %(message)s",
    datefmt="%Y-%m-%d %H:%M:%S",
)
log = logging.getLogger(__name__)

def log_success(step: str, details: str = ""):
    log.info(f"[SUCCESS] {step} – {details}")

def log_failure(step: str, err: Exception):
    log.error(f"[FAIL] {step} – {type(err).__name__}: {err}")

# --------------------------------------------------------------
# ────────  1️⃣  LANDING PAGE GENERATOR  ───────────────────────
# --------------------------------------------------------------
HTML_TEMPLATE = """<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{product_name} – Launch</title>
<link rel="stylesheet" href="styles.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="container">
  <h1>{product_name}</h1>
  <p class="tagline">{product_tagline}</p>

  <section class="benefits">
    <h2>Why you’ll love it</h2>
    <ul>
      {benefits_html}
    </ul>
  </section>

  <section class="pricing">
    <h2>One‑time price – ${price_usd:.2f}</h2>
    <form action="{checkout_url}" method="POST">
      <button type="submit" class="checkout-btn">Buy now</button>
    </form>
  </section>

  {lead_magnet_section}
</div>
</body>
</html>
"""

CSS_CONTENT = """/* ------------------------------------------------------------------
   Simple responsive landing page – generated by ciel_auto_market_product_launch
   ------------------------------------------------------------------ */
body{margin:0;padding:0;font-family:Arial,Helvetica,sans-serif;background:#f5f5f5;color:#333}
.container{max-width:800px;margin:40px auto;background:#fff;padding:30px;border-radius:8px;box-shadow:0 2px 8px rgba(0,0,0,.1)}
h1{font-size:2.5rem;margin-bottom:.5rem}
.tagline{font-size:1.2rem;color:#555;margin-bottom:2rem}
.benefits ul{list-style:none;padding:0}
.benefits li{margin:0.8rem 0;padding-left:1.5rem;position:relative}
.benefits li::before{content:"✔";position:absolute;left:0;color:#28a745}
.pricing{margin-top:2rem;text-align:center}
.checkout-btn{background:#6772e5;color:#fff;border:none;padding:.8rem 1.5rem;font-size:1.1rem;border-radius:4px;cursor:pointer}
.checkout-btn:hover{background:#5469
Enter fullscreen mode Exit fullscreen mode

Top comments (0)