File size: 7,140 Bytes
17f54f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# n8n Workflows

## Docker Compose n8n

The project Docker Compose stack includes n8n at:

```text
http://localhost:5678
```

Copy `.env.example` to `.env`, then set at least:

```env
MAESTER_API_KEY=your_maester_api_key
N8N_ENCRYPTION_KEY=generate_a_long_stable_random_value
PEXELS_API_KEY=your_pexels_api_key
```

The compose file injects these values into n8n:

```env
MAESTER_BASE_URL=http://maester-enterprise:7860
MAESTER_API_KEY=your_maester_api_key
OPENAI_API_KEY=your_openai_api_key
GEMINI_API_KEY=your_gemini_api_key
OPENROUTER_API_KEY=your_openrouter_api_key
AI_PROVIDER=openai
LLM_PROVIDER=openai
PEXELS_API_KEY=your_pexels_api_key
LLM_MODEL=gpt-4o-mini
KTTS_MODEL=kokoro-v0_19.onnx
KTTS_VOICE=af_bella.pt
```

Import any workflow JSON from this folder into n8n after the stack is running.

## AI Provider Smoke Test

Import:

```text
ai_provider_smoke_test.json
```

Set `AI_PROVIDER` or `LLM_PROVIDER` in `.env` to one of:

```text
openai
gemini
openrouter
```

The workflow uses these provider-specific variables:

```env
OPENAI_API_KEY=
OPENAI_BASE_URL=https://api.openai.com/v1
OPENAI_MODEL=gpt-4o-mini

GEMINI_API_KEY=
GEMINI_BASE_URL=https://generativelanguage.googleapis.com/v1beta
GEMINI_MODEL=gemini-1.5-flash

OPENROUTER_API_KEY=
OPENROUTER_BASE_URL=https://openrouter.ai/api/v1
OPENROUTER_MODEL=openai/gpt-4o-mini
OPENROUTER_SITE_URL=http://localhost:5678
OPENROUTER_APP_NAME=Maester Enterprise
```

OpenRouter uses the OpenAI-compatible chat completions format. Gemini uses the `generateContent` endpoint and returns a Gemini-shaped response.

## Webhook TikTok Storytelling With Pexels

Import:

```text
webhook_tiktok_storytelling_pexels.json
```

This workflow exposes an n8n webhook at:

```text
POST /webhook/maester/create-tiktok-story
```

Example payload:

```json
{
  "topic": "a founder saves 10 hours a week with automation",
  "series_title": "Automation Proof",
  "audience": "small business owners",
  "scene_count": 5,
  "scene_duration": 5,
  "output_name": "automation_proof_episode_01.mp4"
}
```

The webhook creates a TikTok render payload, searches Pexels for portrait clips, submits the job to `/services/render/render`, and returns Maester's `job_id`, `status_url`, and `download_url`. Poll `MAESTER_BASE_URL + status_url` until the job state is complete, then download from `MAESTER_BASE_URL + download_url`.

## TikTok Storytelling Mini Series With Pexels

Import `tiktok_storytelling_pexels.json` into n8n.

For the full autonomous version from the project specification, import:

```text
autonomous_tiktok_storytelling_miniseries.json
```

Required n8n environment variables:

```env
MAESTER_BASE_URL=https://your-maester-space.hf.space
MAESTER_API_KEY=your_maester_api_key
PEXELS_API_KEY=your_pexels_api_key
OPENAI_API_KEY=your_openai_api_key
LLM_MODEL=gpt-4o-mini
KTTS_MODEL=kokoro-v0_19.onnx
KTTS_VOICE=af_bella.pt
```

What the workflow does:

1. Builds a five-scene TikTok storytelling episode.
2. Searches Pexels videos for each scene query.
3. Picks portrait MP4 assets when available.
4. Creates a Maester render payload with scene captions, text overlays, blur background, and per-scene effects.
5. Submits the render job to `/services/render/render`.

The workflow expects all services to be enabled in Maester:

```env
MAESTER_MOUNT_SERVICES=true
MAESTER_ENABLE_RENDER_ENGINE=true
```

The final node returns the render job response. Add a `Wait` node and an HTTP Request node against the returned `status_url` if you want automatic polling.

Pexels attribution metadata is included in each scene under `metadata.pexels` so you can preserve attribution data in downstream reports.

## Autonomous Mini-Series Workflow

`autonomous_tiktok_storytelling_miniseries.json` implements this production pipeline:

1. Configures the topic: `The Girl Who Disappeared Every Midnight`.
2. Calls OpenAI Chat Completions and requests strict JSON story output.
3. Validates the returned story schema.
4. Creates a Maester campaign record through `/automation/campaigns`.
5. Runs Maester quality and compliance checks.
6. Loops through scenes inside an n8n Code node.
7. Searches Pexels portrait videos with retry queries.
8. Generates KTTS narration for every scene through `/services/ktts/v1/audio/speech`.
9. Uploads scene narration files to `/services/render/upload`.
10. Generates and uploads a full episode narration track for the final render engine voiceover.
11. Builds a 1080x1920 TikTok render payload with captions, blur background, scene effects, animated subtitle settings, and Pexels attribution metadata.
12. Submits the final render to `/services/render/render`.

The render engine accepts one global `voiceover` track, so the workflow generates per-scene narration artifacts for traceability and also creates one combined narration track for final video rendering.

## Islamic Motivation TikTok Automation Pipeline

Import:

```text
islamic_motivation_tiktok_pipeline.json
```

This workflow implements the Islamic motivation pipeline:

1. Runs once per day from an n8n Schedule Trigger.
2. Calls GPT-4o for a respectful Islamic motivational topic and narration.
3. Calls GPT-4o again for exactly five cinematic Pexels-optimized scenes.
4. Searches Pexels portrait videos scene by scene, with `nature` fallback.
5. Downloads each clip and sends it to Maester FFmpeg automation.
6. Trims and resizes each clip to 1080x1920 / 9:16.
7. Concats clips in deterministic scene order.
8. Searches Archive.org for an Islamic nasheed and continues without music if none is found.
9. Burns TikTok-style ASS captions into the video.
10. Merges nasheed audio at low volume.
11. Normalizes the final MP4 for TikTok compatibility.
12. Uploads the final file to Maester render inspection and validates duration, size, audio, and video stream metadata.
13. Uploads to TikTok if `TIKTOK_UPLOAD_ENABLED=true`; otherwise returns a dry-run render result.
14. Sends Google Sheets and Telegram status updates.

Required environment variables:

```env
MAESTER_BASE_URL=https://your-maester-space.hf.space
MAESTER_API_KEY=your_maester_api_key
OPENAI_API_KEY=your_openai_api_key
PEXELS_API_KEY=your_pexels_api_key
```

Optional publishing/logging variables:

```env
TELEGRAM_BOT_TOKEN=123456:telegram_bot_token
TELEGRAM_CHAT_ID=123456789
GOOGLE_SHEETS_WEBHOOK_URL=https://script.google.com/macros/s/your-script-id/exec
TIKTOK_UPLOAD_ENABLED=false
TIKTOK_ACCESS_TOKEN=your_tiktok_content_posting_access_token
```

Required Maester services:

```env
MAESTER_MOUNT_SERVICES=true
MAESTER_ENABLE_FFMPEG_AUTOMATION=true
MAESTER_ENABLE_RENDER_ENGINE=true
```

The workflow uses these Maester endpoints:

- `/automation/campaigns`
- `/automation/compliance/check`
- `/services/ffmpeg/n8n/execute/trim`
- `/services/ffmpeg/n8n/execute/resize_916`
- `/services/ffmpeg/n8n/execute/concat`
- `/services/ffmpeg/n8n/execute/add_subtitles`
- `/services/ffmpeg/n8n/execute/merge_music`
- `/services/ffmpeg/n8n/execute/normalize`
- `/services/render/upload`
- `/services/render/inspect`

TikTok upload is intentionally dry-run by default. Enable it only after your TikTok Content Posting API app is approved and tested.