File size: 1,975 Bytes
9a43362
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# CarouselForge — API Contracts

All responses follow: `{ success: boolean, data?: T, error?: string }`

---

## POST /api/ingest
Accepts raw input and returns extracted content.

**Request:**
```json
{
  "type": "text" | "url" | "pdf" | "topic",
  "content": "string (text/url/topic) | base64 (pdf)"
}
```

**Response:**
```json
{
  "success": true,
  "data": {
    "extracted_text": "...",
    "source_platform": "instagram" | "twitter" | "web" | null,
    "source_url": "..." | null
  }
}
```

---

## POST /api/structure
Sends extracted content to LLM, returns slide structure.

**Request:**
```json
{
  "content": "extracted text",
  "platform": "instagram" | "threads" | "linkedin",
  "brand_id": 1
}
```

**Response:**
```json
{
  "success": true,
  "data": {
    "carousel_id": 42,
    "slides": [...],
    "caption": "...",
    "hashtags": ["#ai", "#tech"]
  }
}
```

---

## POST /api/render
Renders slides to PNG images.

**Request:**
```json
{ "carousel_id": 42, "template_id": "bold-statement" }
```

**Response:**
```json
{
  "success": true,
  "data": {
    "image_paths": ["/tmp/renders/42/1.png", ...],
    "pdf_path": "/tmp/renders/42/carousel.pdf"
  }
}
```

---

## POST /api/publish
Publishes carousel to social platforms.

**Request:**
```json
{
  "carousel_id": 42,
  "platforms": ["instagram", "threads"],
  "scheduled_for": "2024-01-15T09:00:00Z" | null
}
```

---

## GET /api/analytics
Returns engagement data for published carousels.

---

## POST /api/research
Triggers trending topic research for a brand.

**Request:** `{ "brand_id": 1 }`

---

## POST /api/telegram/webhook
Receives Telegram bot updates. Handled by Telegraf internally.

---

## POST /api/telegram/notify
Sends a notification to a Telegram user.

**Request:**
```json
{
  "chat_id": "123456789",
  "type": "carousel_preview" | "publish_confirm" | "daily_brief",
  "payload": { ... }
}
```

---

*Endpoints filled in as phases are completed. See phase guide for full specs.*