DEV Community

Nexus Intelligence Research
Nexus Intelligence Research

Posted on

🚀 Launching **CIEL Insights** – The Premium AI + Crypto + Geopolitics Newsletter

Your go‑to source for deep‑dive analysis, actionable data, and the future‑shaping trends you can’t afford to miss.


Tags: #ai #crypto #geopolitics #newsletter


TL;DR

  1. Create a Substack newsletter called CIEL Insights via the Substack API (or Playwright).
  2. Import three existing Dev.to posts as the first premium issues.
  3. Hook the existing Stripe PRO product ($29/month) to handle paid subscriptions.
  4. Craft a punchy promotional blurb and push it to Dev.to, Reddit, and X (Twitter).
  5. Set up a welcome‑email series that drops a 20 % discount code for the first 10 subscribers.
  6. Log every promotion URL and watch Stripe for the inaugural sale.

Below is a complete, step‑by‑step guide (with ready‑to‑copy code snippets) that you can drop into a Python/Node/Playwright project. All snippets use official APIs and assume you already have the necessary API keys and OAuth tokens.

⚡ Pro tip: Keep the code in a CI pipeline (GitHub Actions, GitLab CI, or a simple cron job) so the whole workflow can be re‑run on demand.


1️⃣ Spin Up the Substack Publication

1.1 Using the Substack GraphQL endpoint (recommended)

# Install dependencies
pip install requests gql
Enter fullscreen mode Exit fullscreen mode
# create_substack.py
import os
from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport

# -------------------------------------------------
# 1️⃣  AUTH – Grab your Substack session cookie
# -------------------------------------------------
SUBSTACK_COOKIE = os.getenv("SUBSTACK_COOKIE")   # e.g. substack_session=…

transport = RequestsHTTPTransport(
    url="https://substack.com/api/graphql",
    headers={"Cookie": SUBSTACK_COOKIE},
    use_json=True,
)

client = Client(transport=transport, fetch_schema_from_transport=True)

# -------------------------------------------------
# 2️⃣  CREATE PUBLICATION
# -------------------------------------------------
mutation = gql("""
mutation CreatePublication($input: PublicationCreateInput!) {
  createPublication(input: $input) {
    publication {
      id
      slug
      title
    }
  }
}
""")

variables = {
    "input": {
        "title": "CIEL Insights",
        "slug": "ciel-insights",
        "description": "AI, crypto, geopolitics & data‑analysis for the modern entrepreneur.",
        "category": "TECH",
        "visibility": "PUBLIC"
    }
}

result = client.execute(mutation, variable_values=variables)
pub = result["createPublication"]["publication"]
print(f"✅ Publication created: https://{pub['slug']}.substack.com")
Enter fullscreen mode Exit fullscreen mode

⚠️ Substack does not expose a public “create‑publication” API. The GraphQL call above works only if you have a valid session cookie (obtained after logging in). For a fully automated, no‑cookie approach you can fall back to Playwright to simulate the UI – see the optional Playwright snippet at the bottom of this article.

1.2 (Optional) Playwright UI automation

# playwright_create.py
from playwright.sync_api import sync_playwright

def create_substack():
    with sync_playwright() as p:
        browser = p.chromium.launch(headless=False)
        page = browser.new_page()
        page.goto("https://substack.com/sign-in")
        # 👉 Fill email / password, handle 2FA if needed
        page.fill('input[name="email"]', "you@example.com")
        page.click('button:has-text("Continue")')
        # … wait for login …
        page.goto("https://substack.com/new")
        page.fill('input[name="title"]', "CIEL Insights")
        page.fill('input[name="slug"]', "ciel-insights")
        page.click('button:has-text("Create publication")')
        print("✅ Publication created!")
        browser.close()

create_substack()
Enter fullscreen mode Exit fullscreen mode

NOTE: Playwright is slower but works around the lack of a public API. Keep the script in a secure repo and never commit your credentials.


2️⃣ Import Your Existing Dev.to Articles as Premium Issues

Assume you have three Dev.to URLs:

https://dev.to/yourname/ai‑crypto‑synergy-3b5
https://dev.to/yourname/geopolitics‑of‑data‑2024-1a2
https://dev.to/yourname/next‑gen‑data‑analysis‑tips‑c7f
Enter fullscreen mode Exit fullscreen mode

2.1 Pull the Markdown via the Dev.to API

import requests, json, os

DEVTO_TOKEN = os.getenv("DEVTO_API_KEY")
HEADERS = {"api-key": DEVTO_TOKEN}
DEVTO_ARTICLES = [
    "ai-crypto-synergy-3b5",
    "geopolitics-of-data-2024-1a2",
    "next-gen-data-analysis-tips-c7f"
]

def fetch_markdown(slug):
    r = requests.get(f"https://dev.to/api/articles/{slug}", headers=HEADERS)
    r.raise_for_status()
    return r.json()["body_markdown"]
Enter fullscreen mode Exit fullscreen mode

2.2 Push each article to Substack as a paid post

def publish_to_substack(md, title, is_premium=True):
    mutation = gql("""
    mutation CreatePost($input: PostCreateInput!) {
      createPost(input: $input) {
        post { id slug }
      }
    }
    """)
    variables = {
        "input": {
            "title": title,
            "bodyMarkdown": md,
            "publicationId": pub["id"],
            "isPaid": is_premium,
            "visibility": "PUBLIC"
        }
    }
    res = client.execute(mutation, variable_values=variables)
    return res["createPost"]["post"]["slug"]

for slug in DEVTO_ARTICLES:
    md = fetch_markdown(slug)
    title = md.split("\n")[0].lstrip("# ").strip()
    substack_slug = publish_to_substack(md, title)
    print(f"✅ Published {title} → https://ciel-insights.substack.com/p/{substack_slug}")
Enter fullscreen mode Exit fullscreen mode

Top comments (0)