Skip to content

Yanu403/digital-mate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

50 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Digital Mate Banner

πŸ€– Digital Mate

Stop guessing. Start marketing like you have a full team.

An AI marketing assistant in Telegram that plans, creates, and analyzes β€” from captions to campaign strategies to performance reports. Automated tests. Defense-in-depth security. Local dashboard included.

Chat with it like a marketing colleague. It does the rest.

Python License CI Telegram

Tech Stack: Python 3.11+ Β· python-telegram-bot Β· OpenAI-compatible LLM Β· SQLite Β· Notion API

Why Digital Mate? Β· Who is this for? Β· Features Β· Demo Β· Quick Start Β· Architecture Β· Contributing Β· Roadmap


🎯 What is Digital Mate?

Digital Mate is a production-grade AI marketing assistant built for Telegram. It understands natural language marketing requests, routes them to specialized AI pipelines, and delivers actionable outputs β€” captions, strategies, research reports, and analytics.

No dashboard. No learning curve. Just chat.


πŸ”₯ Why Digital Mate?

Feature ChatGPT Generic AI Bots Digital Mate
Marketing-specific prompts ❌ Generic ⚠️ Basic βœ… 4 specialized pillars
Multi-step workflows ❌ Single turn ❌ βœ… Automatic tool chaining
Self-reflection & auto-optimization ❌ ❌ βœ… Quality scoring + refinement
Proactive reminders ❌ ❌ βœ… Weekly digests + nudges
Security hardening ⚠️ Basic ❌ βœ… 510 tests, 3 guard layers
Brand voice memory ❌ ⚠️ Limited βœ… Per-chat brand profiles
Open source ❌ ❌ βœ… MIT License
Telegram native ❌ ⚠️ Some βœ… Built for Telegram

Most AI tools give you a blank chat box. Digital Mate gives you a marketing team β€” with memory, workflows, quality control, and security built in.


πŸ‘‹ Who is this for?

  • πŸ§‘β€πŸ’» Solo founders β€” "I need marketing content but can't afford an agency."
  • πŸͺ Small business owners β€” "I know I should post on social media but don't know what."
  • πŸ§‘β€πŸŽ¨ Marketing freelancers β€” "I need to scale my output without sacrificing quality."
  • πŸš€ Startup teams β€” "We need a marketing strategy but our budget is $0."

If you think in marketing terms but don't have a team to execute β€” Digital Mate is your team.


You: Write me 3 Instagram captions for a new coffee shop in Jakarta
Mate: πŸš€ 3 Caption Variations β€” Coffee Shop Launch
      β˜• Variation 1: Warm & Inviting β€” "first sip hits different..."
      πŸ”₯ Variation 2: Playful & Bold β€” "POV: You just found your new spot..."
      🀍 Variation 3: Minimal & Aesthetic β€” "Good coffee. Warm light..."

✨ Features

πŸ–ŠοΈ Content & Copywriting

  • Multi-platform captions β€” Instagram, TikTok, Twitter/X, LinkedIn, Facebook
  • Hook generator β€” 8+ psychological hook frameworks (curiosity gap, pain point, bold claim...)
  • Content calendar β€” Weekly content plans with channel-specific scheduling
  • Newsletter & email β€” Subject lines, body copy, CTA optimization
  • Hashtag strategy β€” Mix of reach, niche, and branded hashtags

πŸ“‹ Strategy & Planning

  • Campaign blueprints β€” Full funnel breakdown (awareness β†’ conversion)
  • Launch playbooks β€” Phase-by-phase launch strategies with timelines
  • Marketing audits β€” Structured checklist-based analysis
  • Budget allocation β€” Channel mix recommendations by goal

πŸ”Ž Research & Insight

  • Competitor analysis β€” Real-time web research with structured reports
  • Audience personas β€” Data-driven persona builder with demographics + psychographics
  • Keyword research β€” Volume, difficulty, intent mapping
  • Trend monitoring β€” Industry trend identification via live web search

πŸ“Š Analytics & Reporting

  • Performance reports β€” Input raw metrics, get executive summaries
  • KPI frameworks β€” Platform-specific benchmark comparisons
  • Whatβ†’Whyβ†’Do β€” Structured interpretation methodology
  • Action prioritization β€” Impact vs. effort matrix for next steps

πŸ”„ Tool Chaining β€” Multi-Step Workflows

  • Research β†’ Content β€” Search trends, then generate captions referencing real data
  • Research β†’ Strategy β€” Competitor analysis feeds into a marketing plan
  • Analytics β†’ Strategy β€” Interpret metrics, then recommend improvements
  • Strategy β†’ Content β€” Marketing plan drives a content calendar
  • Progress streamed to user: "πŸ” Searching trends... β†’ ✍️ Writing caption..."

🎯 Goal Decomposition β€” Complex Plans

  • Automatic planning β€” Break "launch a product" into 2–7 concrete steps
  • Step-by-step execution β€” Each step runs the right pillar with the right data
  • Plan persistence β€” Plans survive bot restarts, resume automatically on startup
  • /plan command β€” View progress, cancel anytime with /cancelplan

✨ Self-Reflection β€” Auto-Optimized Output

  • Critic + Refiner loop β€” Evaluates output on hook strength, brand voice, CTA clarity
  • Automatic iteration β€” Scores < 7 trigger regeneration (up to 2 rounds)
  • ✨ Auto-optimized indicator shown when reflection improved the output
  • Pillar-aware β€” Always runs for Content/Strategy, optional for Research, skips Analytics/General

πŸ”” Proactive Intelligence

  • Trend digests β€” Weekly search for trending topics in the user's industry
  • Content reminders β€” Nudge when the user hasn't posted recently
  • Campaign alerts β€” Flag when a campaign has been running long enough to review
  • /digest command β€” Trigger an on-demand trend digest

πŸ“Έ Vision

  • Image analysis β€” Send screenshots, ads, or analytics dashboards
  • Context-aware β€” Vision results feed into the appropriate pillar for interpretation
  • Multi-format β€” Supports photos, documents, and image replies

🧠 Long-Term Memory

  • Key facts extraction β€” Auto-extracts 0–3 facts every 10 messages
  • Cross-session recall β€” Facts injected into future prompts for continuity
  • /forget command β€” Clear stored key facts on demand

πŸ“Έ Demo

Welcome & Onboarding

Digital Mate Welcome

AI-Powered Content Creation

Content Creation Demo

Security Guard β€” Prompt Injection Protection

Security Guard Demo

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      Telegram Bot                           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚  /start       β”‚   β”‚  /brand      β”‚   β”‚  /calendar   β”‚    β”‚
β”‚  β”‚  /plan        β”‚   β”‚  /digest     β”‚   β”‚  /forget     β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β”‚
β”‚                            β–Ό                                β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚              πŸ›‘οΈ Security Guard Layer                β”‚    β”‚
β”‚  β”‚  Input Guard:  injection | role hijack | exfil      β”‚    β”‚
β”‚  β”‚  Output Guard: leakage | hallucination markers      β”‚    β”‚
β”‚  β”‚  Brand Guard:  field sanitization | injection strip β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                            β–Ό                                β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚         🧠 Intent Router + Routing Classifier       β”‚    β”‚
β”‚  β”‚  LLM classify β†’ pillar + action                      β”‚    β”‚
β”‚  β”‚  Route decision β†’ workflow | plan | single           β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                            β–Ό                                β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚              πŸ€– Agent Orchestrator                  β”‚    β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚    β”‚
β”‚  β”‚  β”‚ Workflow  β”‚  β”‚ Planner  β”‚  β”‚ Reflection       β”‚  β”‚    β”‚
β”‚  β”‚  β”‚ Engine    β”‚  β”‚ + Executorβ”‚  β”‚ (Critic+Refiner) β”‚  β”‚    β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                            β–Ό                                β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚ Content  β”‚  β”‚ Strategy β”‚  β”‚ Research β”‚  β”‚Analytics β”‚    β”‚
β”‚  β”‚  Pillar  β”‚  β”‚  Pillar  β”‚  β”‚  Pillar  β”‚  β”‚  Pillar  β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚         β”‚              β”‚             β”‚            β”‚          β”‚
β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚
β”‚                        β–Ό                                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚              πŸ“¦ Infrastructure Layer                 β”‚    β”‚
β”‚  β”‚  SQLite (sessions, brand, plans, key_facts, triggers)β”‚    β”‚
β”‚  β”‚  Notion β”‚ Tavily/DuckDuckGo β”‚ Vision β”‚ Scheduler    β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Design Decisions

Decision Choice Why
LLM backend OpenAI-compatible API Pluggable β€” works with OpenAI, Anthropic, local models, any compatible endpoint
Intent routing LLM classification + keyword fallback Accurate semantic routing without fine-tuning
Route dispatch Orchestrator decides: workflow, plan, or single Same classifier output, three execution paths
Memory SQLite + session context + key facts Zero-dependency, no external DB needed
Prompts .md template files Easy to edit, version control, iterate without code changes
Security Input/Output/Brand guards Defense-in-depth against prompt injection, data leakage, role hijacking
Integrations Notion + Web Search + Vision Real data, not hallucinated marketing advice
Reflection Critic + Refiner loop (max 2 rounds) Quality gate without infinite loops
Planning LLM planner + executor + SQLite plan store Survives restarts, supports /plan and /cancelplan

πŸš€ Quick Start

One-Line Install

curl -sSL https://raw.githubusercontent.com/Yanu403/digital-mate/master/install.sh | bash

This installs Digital Mate to ~/.digital-mate/, sets up Python venv, and creates the .env config file.

Then start the dashboard:

DASHBOARD_API_KEY="$(openssl rand -hex 24)" ~/.digital-mate/bin/digital-mate serve

Or set DASHBOARD_API_KEY in .env, then run:

~/.digital-mate/bin/digital-mate serve

Open http://localhost:7749/?api_key=<your-dashboard-key> β€” configure your Telegram token, LLM key, and brand profile from the web UI. No terminal editing needed.

Or auto-launch after install:

curl -sSL https://raw.githubusercontent.com/Yanu403/digital-mate/master/install.sh | bash -s -- --launch

Manual Install

git clone https://github.com/Yanu403/digital-mate.git
cd digital-mate
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env

Configuration

Edit .env with your credentials:

# Required
TELEGRAM_BOT_TOKEN=your_bot_token
LLM_BASE_URL=https://api.openai.com/v1
LLM_API_KEY=your_api_key
LLM_MODEL=gpt-4o

# Optional
NOTION_API_KEY=your_notion_key
SEARCH_PROVIDER=duckduckgo

Works with any OpenAI-compatible endpoint: OpenAI, Anthropic (via proxy), Groq, Together AI, local Ollama, LM Studio, vLLM, etc.

Run

# Development
python -m digital_mate

# Headless bot
digital-mate run

# Local dashboard and bot manager
digital-mate serve

πŸ€– Bot Commands

Command Description
/start Welcome message & quick tour
/help Full command list with examples
/brand Set up your brand profile (name, tone, audience, competitors)
/calendar Generate a weekly content calendar
/research Deep research on a topic, competitor, or trend
/report Create a performance report from your metrics
/plan View active plan progress or start a new goal plan
/cancelplan Cancel the currently running plan
/digest Trigger an on-demand trend digest
/forget Clear stored key facts (long-term memory)
/history View your recent conversations
/clear Reset conversation context

Natural Language

Just talk to it naturally β€” no commands needed:

"Analyze my competitor @brandx on Instagram"
"Write a launch email for my SaaS product"
"What are the trending hashtags for fintech in Indonesia?"
"I got 15K impressions, 2.3% engagement, 45 clicks β€” analyze this"

πŸ”’ Security

Digital Mate ships with a defense-in-depth security layer protecting against common LLM application attacks:

Input Guard

Blocks malicious prompts before they reach the LLM:

Attack Vector Detection Status
Prompt extraction "ignore instructions", "reveal system prompt" πŸ›‘οΈ Blocked
Role hijacking "you are now DAN", "pretend you're..." πŸ›‘οΈ Blocked
Data exfiltration "send data to URL", "exfiltrate API keys" πŸ›‘οΈ Blocked
Obfuscation Base64-encoded injection, Unicode tricks πŸ›‘οΈ Blocked
Harmful content Phishing, malware, social engineering πŸ›‘οΈ Blocked

Output Guard

Scans LLM responses for:

  • System prompt leakage
  • Internal configuration exposure
  • API key / credential fragments

Brand Profile Sanitizer

All user-provided brand fields are sanitized against:

  • Code block injection
  • XML/ChatML tag injection
  • Markdown separator abuse

Automated tests cover security scenarios and run in CI on supported Python versions. See tests/test_security.py.


πŸ§ͺ Testing

# Install test and build tooling
pip install -r requirements-dev.txt

# Run all tests
pytest

# With the same coverage gate used by CI
pytest --cov=digital_mate --cov-report=term-missing --cov-fail-under=70

# Run specific test suite
pytest tests/test_security.py -v        # Security tests
pytest tests/test_content.py -v         # Content pillar tests
pytest tests/test_router.py -v          # Intent routing tests
pytest tests/test_orchestrator.py -v    # Orchestrator + workflow tests
pytest tests/test_planner.py -v         # Goal decomposition tests
pytest tests/test_critic.py -v          # Self-reflection critic tests
pytest tests/test_refiner.py -v         # Self-reflection refiner tests
pytest tests/test_reflection.py -v      # Reflection engine tests
pytest tests/test_triggers.py -v        # Proactive trigger tests
pytest tests/test_scheduler.py -v       # Scheduler tests
pytest tests/test_key_facts.py -v       # Long-term memory tests
pytest tests/test_feedback.py -v        # Feedback button tests

Pull requests and pushes to master run tests with coverage on Python 3.11 and 3.12, then verify the wheel and source distribution can be built.

Operations Endpoints

Endpoint Authentication Purpose
GET /api/health Public Liveness, application version, and timestamp
GET /api/ready Public Required configuration and SQLite availability
GET /api/metrics X-API-Key Aggregate LLM requests, failures, latency, in-flight calls, and provider token usage

Metrics are aggregate and process-local. They never contain prompts, responses, credentials, or user/chat identifiers. The bot writes its latest snapshot to METRICS_PATH (default data/runtime-metrics.json) so the separate dashboard process can expose it. Token counters are populated when the LLM provider returns OpenAI-compatible usage metadata. For release steps and rollback guidance, see docs/RELEASING.md.


πŸ“ Project Structure

digital-mate/
β”œβ”€β”€ digital_mate/
β”‚   β”œβ”€β”€ AGENT.md              # Bot personality & marketing expertise
β”‚   β”œβ”€β”€ bot.py                # Telegram handlers + security integration
β”‚   β”œβ”€β”€ config.py             # Environment configuration
β”‚   β”œβ”€β”€ router.py             # LLM-powered intent classification
β”‚   β”œβ”€β”€ llm/
β”‚   β”‚   β”œβ”€β”€ client.py         # OpenAI-compatible async client
β”‚   β”‚   └── prompts.py        # Template engine (.md file loader)
β”‚   β”œβ”€β”€ agent/
β”‚   β”‚   β”œβ”€β”€ orchestrator.py   # Central dispatch: workflow | plan | single
β”‚   β”‚   β”œβ”€β”€ workflow.py       # Workflow engine + 4 built-in workflows
β”‚   β”‚   β”œβ”€β”€ planner.py        # LLM goal decomposition (2–7 steps)
β”‚   β”‚   β”œβ”€β”€ executor.py       # Plan step execution + error recovery
β”‚   β”‚   β”œβ”€β”€ plan_store.py     # SQLite plan persistence (resume on restart)
β”‚   β”‚   β”œβ”€β”€ critic.py         # Output quality evaluator
β”‚   β”‚   β”œβ”€β”€ refiner.py        # Iterative output improvement
β”‚   β”‚   β”œβ”€β”€ reflection.py     # Reflection engine (critic + refiner loop)
β”‚   β”‚   β”œβ”€β”€ triggers.py       # Proactive trigger definitions + detection
β”‚   β”‚   └── scheduler.py      # Cron-like scheduled task runner
β”‚   β”œβ”€β”€ pillars/
β”‚   β”‚   β”œβ”€β”€ base.py           # Base pillar with shared context
β”‚   β”‚   β”œβ”€β”€ content.py        # Content & copywriting pipeline
β”‚   β”‚   β”œβ”€β”€ strategy.py       # Strategy & planning pipeline
β”‚   β”‚   β”œβ”€β”€ research.py       # Research & insight pipeline
β”‚   β”‚   └── analytics.py      # Analytics & reporting pipeline
β”‚   β”œβ”€β”€ prompts/              # Prompt templates (editable .md files)
β”‚   β”‚   β”œβ”€β”€ router.md         # Intent classification rules
β”‚   β”‚   β”œβ”€β”€ content.md        # Content generation expertise
β”‚   β”‚   β”œβ”€β”€ strategy.md       # Strategic planning frameworks
β”‚   β”‚   β”œβ”€β”€ research.md       # Research methodology
β”‚   β”‚   β”œβ”€β”€ analytics.md      # Analytics interpretation
β”‚   β”‚   β”œβ”€β”€ planner.md        # Goal decomposition prompt
β”‚   β”‚   └── general.md        # Chitchat / help responses
β”‚   β”œβ”€β”€ integrations/
β”‚   β”‚   β”œβ”€β”€ notion_client.py  # Notion API integration
β”‚   β”‚   └── search.py         # Tavily / DuckDuckGo search
β”‚   β”œβ”€β”€ memory/
β”‚   β”‚   β”œβ”€β”€ database.py       # SQLite async storage (schema v7)
β”‚   β”‚   β”œβ”€β”€ session.py        # Conversation context (last N turns)
β”‚   β”‚   β”œβ”€β”€ brand_profile.py  # Per-chat brand profiles
β”‚   β”‚   β”œβ”€β”€ key_facts.py      # Long-term memory (auto-extract every 10 msgs)
β”‚   β”‚   β”œβ”€β”€ response_store.py # Feedback storage (πŸ‘/πŸ‘Ž/πŸ”„)
β”‚   β”‚   └── autocalendar.py   # Auto content calendar generator
β”‚   └── utils/
β”‚       β”œβ”€β”€ formatting.py     # Markdown formatting for Telegram
β”‚       β”œβ”€β”€ validators.py     # Input validation
β”‚       β”œβ”€β”€ security.py       # Security guard layer
β”‚       β”œβ”€β”€ keyboards.py      # Inline feedback keyboards (πŸ‘/πŸ‘Ž/πŸ”„)
β”‚       └── image.py          # Vision / image processing
β”œβ”€β”€ tests/                    # 510 automated tests
β”œβ”€β”€ deploy/                   # Systemd service files
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ ARCHITECTURE.md       # Architecture deep-dive
β”‚   β”œβ”€β”€ notion-setup.md       # Notion database setup guide
β”‚   └── screenshots/          # Demo screenshots
β”œβ”€β”€ .env.example              # Configuration template
β”œβ”€β”€ requirements.txt          # Python dependencies
└── LICENSE                   # MIT

βš™οΈ Configuration

Required

Variable Description
TELEGRAM_BOT_TOKEN Bot token from @BotFather
LLM_BASE_URL OpenAI-compatible API endpoint
LLM_API_KEY API key for your LLM provider
LLM_MODEL Model name (e.g., gpt-4o, mimo-v2.5-pro)

Optional

Variable Default Description
NOTION_API_KEY β€” Notion integration token
NOTION_CALENDAR_DB β€” Content calendar database ID
NOTION_CAMPAIGN_DB β€” Campaign tracker database ID
SEARCH_PROVIDER duckduckgo Search backend (tavily or duckduckgo)
TAVILY_API_KEY β€” Required if using Tavily search
MAX_HISTORY 10 Conversation context window
BOT_LANGUAGE en Default language (en, id, es, zh, ja)
LOG_LEVEL INFO Logging verbosity

πŸ—ΊοΈ Roadmap

βœ… Phase 1 β€” Core

  • 4 marketing pillars (content, strategy, research, analytics)
  • LLM-powered intent routing
  • Bilingual support (English + Indonesian)
  • Per-chat brand profiles
  • Security guard layer
  • Notion integration
  • Web search integration
  • 105 automated tests (expanded to 510 in Phase 2)

βœ… Phase 2 β€” Agentic Intelligence

  • Tool chaining & multi-step workflows (4 built-in workflows)
  • Goal decomposition & planning (LLM planner, 2–7 steps)
  • Plan persistence & auto-resume on restart
  • Self-reflection engine (critic + refiner, max 2 iterations)
  • Proactive triggers (trend digests, content reminders, campaign alerts)
  • Long-term memory (key facts extraction every 10 messages)
  • /plan, /cancelplan, /forget, /digest commands
  • Vision / image input support
  • Multi-language support (EN, ID, ES, ZH, JA)
  • Feedback buttons (πŸ‘/πŸ‘Ž/πŸ”„)
  • LLM-based routing classifier (replaces keyword matching)
  • Reflection feedback visible to user (✨ Auto-optimized indicator)
  • 510 automated tests

πŸ”œ Phase 3 β€” Expansion

  • WhatsApp Business API integration
  • Auto-scheduled weekly content calendars
  • Image generation for social posts
  • Analytics dashboard (web UI)
  • Custom training on brand voice history

πŸš€ Phase 4 β€” Platform

  • Team collaboration (shared brand profiles)
  • A/B testing suggestions with prediction
  • CRM integration (HubSpot, Salesforce)
  • Social media scheduling (direct posting)

πŸ› οΈ Development

# Install dev dependencies
pip install -r requirements.txt pytest pytest-asyncio pytest-cov

# Run with debug logging
LOG_LEVEL=DEBUG python -m digital_mate

# Format code
black digital_mate/ tests/
ruff check digital_mate/ tests/

Adding a New Pillar

  1. Create digital_mate/pillars/yourpillar.py extending BasePillar
  2. Write prompt template at digital_mate/prompts/yourpillar.md
  3. Register in router's pillar map
  4. Add tests in tests/test_yourpillar.py

Adding a New Workflow

  1. Define the workflow in digital_mate/agent/workflow.py
  2. Add detection logic in digital_mate/agent/orchestrator.py
  3. Add tests in tests/test_workflow.py

🀝 Contributing

Contributions welcome! Here's how:

  1. Fork the repo
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Good first issues

Development setup

git clone https://github.com/Yanu403/digital-mate.git
cd digital-mate
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install pytest pytest-asyncio pytest-cov ruff black
pytest  # Should show 510 passing

πŸ“„ License

MIT License β€” see LICENSE for details.


πŸ™ Acknowledgments


Built with ❀️ by Reazer

⭐ Star this repo if Digital Mate saved you time β€” it helps others discover the project and keeps development going.

Star History Chart

Share on Twitter

About

πŸ€– AI-powered Digital Marketing Assistant β€” content creation, strategy, research & analytics via Telegram. Bilingual EN/ID, Notion integration, pluggable LLM, security-hardened.

Topics

Resources

License

Stars

3 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors