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
- Create a Substack newsletter called CIEL Insights via the Substack API (or Playwright).
- Import three existing Dev.to posts as the first premium issues.
- Hook the existing Stripe PRO product ($29/month) to handle paid subscriptions.
- Craft a punchy promotional blurb and push it to Dev.to, Reddit, and X (Twitter).
- Set up a welcome‑email series that drops a 20 % discount code for the first 10 subscribers.
- 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 # 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") ⚠️ 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() 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 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"] 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}") 