Create episode 8
David Gyori53699a650192
diff --git a/README.md b/README.mdindex c1e0507..6f6e1ab 100644--- a/README.md+++ b/README.md@@ -11,6 +11,7 @@ In this repo, you can find the n8n templates we created for the episodes of [AI- [Episode 5: Creating a blog writing system using deep research](episode_5)- [Episode 6: Lead generation with X-Ray search and LinkedIn](episode_6)- [Episode 7: Creating Youtube short videos using our custom MCP server](episode_7)+- [Episode 8: Creating an AI influencer on Instagram using n8n](episode_8)## MCP serversdiff --git a/episode_8/README.md b/episode_8/README.mdnew file mode 100644index 0000000..a08449a--- /dev/null+++ b/episode_8/README.md@@ -0,0 +1,14 @@+# Episode 8: Creating an AI influencer on Instagram using n8n++## Free n8n JSON workflow++- [Instagram AI influencer n8n workflow](instagram_ai_influencer.json)++## Guides for the workflow++- [Setting up Supabase](guide-supabase.md)+- [Setting up Instagram](guide-instagram.md)++## Watch the video++[](https://www.youtube.com/watch?v=x7kEfmQrHqo)diff --git a/episode_8/guide-instagram.md b/episode_8/guide-instagram.mdnew file mode 100644index 0000000..3ee84a3--- /dev/null+++ b/episode_8/guide-instagram.md@@ -0,0 +1,172 @@+# Setting up Instagram for automations with n8n++## Convert the Instagram account to a business account++> [!IMPORTANT]+> Converting the Instagram account to a business account will make the account public++In the Instagram application, follow these steps to convert your account to a business account.++<table>+ <tr>+ <td>+ 1. Open the settings, and select `Account type and tools`+ <img src="https://github.com/user-attachments/assets/adffda31-f8ce-4a49-a971-40e5cd5f5395" alt="" />+ </td>+ <td>+ 2. Click on `Switch to professinal account`+ <img src="https://github.com/user-attachments/assets/5ea13aeb-b6ac-40b4-906f-2fc563625c52" alt="" />+ </td>+ <td>+ 3. Click on `Next`+ <img src="https://github.com/user-attachments/assets/10942cc8-6045-4ca1-a14a-241a2d94591c" />+ </td>+ </tr>+ <tr>+ <td>+ 4. Select the type of account your want to create+ <img src="https://github.com/user-attachments/assets/c9e19bf8-b48d-49e7-b560-e8edf423233d" alt="" />+ </td>+ <td>+ 5. Select the right category, that describe your account+ <img src="https://github.com/user-attachments/assets/eb4680b2-1d38-476c-8fb0-c428d1e12d04" alt="" />+ </td>+ <td>+ 6. Confirm the choice+ <img src="https://github.com/user-attachments/assets/22ee13cf-f751-4cea-9fc0-be466c885b02" alt="" />+ </td>+ </tr>+</table>++## Create credentials to use with n8n++### 1. Create a Facebook page++Navigate to [https://www.facebook.com/pages/create](https://www.facebook.com/pages/create) to create a new Facebook page.+Fill out the required parameters (name, category) and create the page.++<img width="1554" alt="Screenshot 2025-05-05 at 10 02 00 AM" src="https://github.com/user-attachments/assets/f0e321a2-7b85-4b23-b85b-f8e63281b6b9" />++Now, you need to be acting on behalf of the page - if it's not active for some reason, select it from the menu.++<img width="372" alt="image" src="https://github.com/user-attachments/assets/7aaaccc8-4b0a-4f72-a8c9-f2ecc453584a" />++### 2. Connect Instagram account to the Facebook page++Click on your page's name on the left side.++<img width="379" alt="image" src="https://github.com/user-attachments/assets/fd1ed1d8-8890-4636-a4ae-0496db252283" />++Select `Settings` from the menu.++<img width="368" alt="image" src="https://github.com/user-attachments/assets/641904ec-764e-4d56-bede-618da33db7fe" />++Scroll down to `Permissions` and select `Linked accounts`.++<img width="369" alt="image" src="https://github.com/user-attachments/assets/a024ad7e-8358-4329-a864-c7b621810405" />++Select `Instagram`.++<img width="740" alt="image" src="https://github.com/user-attachments/assets/141164a0-c88e-46a0-a335-466f81297bc6" />++Click on `Connect account` and sign in with your Instagram account.++<img width="708" alt="image" src="https://github.com/user-attachments/assets/5324b945-621b-4f2b-b513-9b51e5b5c071" />++Click on `Connect`.++<img width="573" alt="image" src="https://github.com/user-attachments/assets/85cad094-a815-441a-a0e5-84081fd0ee2d" />++Click on `Confirm`.++<img width="570" alt="image" src="https://github.com/user-attachments/assets/df5bb377-22a8-41de-b99d-0f80052cb372" />++Click on `Continue`.++<img width="561" alt="image" src="https://github.com/user-attachments/assets/81fd3143-f00b-4e33-9521-12c0c9ce623d" />++You are done.++<img width="713" alt="image" src="https://github.com/user-attachments/assets/ce4c0bbe-beed-4c6c-8731-23216efbccb5" />++### 3. Create a Facebook application++Head to [https://developers.facebook.com/apps](https://developers.facebook.com/apps) and click on `Create app`++<img width="1027" alt="image" src="https://github.com/user-attachments/assets/ca5c79b9-974a-4c55-8f88-6def8c1b98d1" />++Select the `Other` use case and hit `Next`.++<img width="1033" alt="image" src="https://github.com/user-attachments/assets/31f296bd-3b47-432b-9037-7974e821a311" />++Select `Business` app type.++<img width="818" alt="image" src="https://github.com/user-attachments/assets/2ab06dd1-33ba-4d87-8365-3637c8327877" />++Review, and click on `Create app`++<img width="815" alt="image" src="https://github.com/user-attachments/assets/c8cc8e1d-c006-428a-9bfa-8cc78a2932c9" />++Add the Instagram product to your app.++<img width="1008" alt="image" src="https://github.com/user-attachments/assets/4186f90b-b619-4c1c-9ea8-bfc5294eaeb4" />++You don't need to configure it, just leave it as it is.+++### 4. Create an access token++From the tools menu, select the `Graph API Explorer`++<img width="877" alt="image" src="https://github.com/user-attachments/assets/006a40a7-894a-4bd0-9483-0d495b77206f" />++You'll see this interface below.++<img width="541" alt="image" src="https://github.com/user-attachments/assets/414ece47-2f1d-4d08-9998-ada85ffb065f" />++1. Make sure the Meta app is the one you just created+2. In the permissions panel, add the following permissions++- `pages_show_list`+- `business_management`+- `instagram_basic`+- `instagram_content_publish`+- `pages_read_engagement`++3. Click on `Generate Access Token`++4. You'll be prompted to select the Facebook page you give access to, the business account and the Instagram account. Select all of them. During the process, take a not of the **Instagram account id** you are connecting, you'll need that later.++<table>+ <tr>+ <td>+ <img width="564" alt="Screenshot 2025-05-09 at 11 07 22 AM" src="https://github.com/user-attachments/assets/6b77415e-1ca2-47f0-b046-974fd391c90a" />+ </td>+ <td>+ <img width="562" alt="Screenshot 2025-05-09 at 11 07 27 AM" src="https://github.com/user-attachments/assets/353b9973-426b-4034-b5fc-e77840ca0d18" />+ </td>+ <td>+ <img width="562" alt="Screenshot 2025-05-09 at 11 08 35 AM" src="https://github.com/user-attachments/assets/58132694-1376-4c40-9d20-61cb8fdb9df5" />+ </td>+ <td>+ <img width="562" alt="Screenshot 2025-05-09 at 11 08 58 AM" src="https://github.com/user-attachments/assets/c2676755-f12f-49d6-9a92-49ea688fc832" />+ </td>+ </tr>+</table>++5. Copy the access token, and head to the [Facebook token debugger tool](https://developers.facebook.com/tools/debug/accesstoken) and paste in the access token, and click `debug`. Scroll to the very bottom of the page, and click on `Extend Access Token`. Copy the long-lived access token.++6. Go back to the `Graph API Explorer` and paste the access token to the access token field and add `me/accounts` to the graph path and click `Submit`. In the results, you'll find field `access_token` that contains the long-lived page access token that will never expire. Copy that.++<img width="693" alt="image" src="https://github.com/user-attachments/assets/0e1bd821-5c27-4c9a-b14e-eeed9c17850f" />++7. (optional) you can verify the expiration of the token, if you paste it to the [Facebook token debugger tool](https://developers.facebook.com/tools/debug/accesstoken).++8. (optional) you can also get the Instagram Business Account's id, if you click on the id of the page in the Graph API explorer, and add `?fields=instagram_business_account` after the id, then click `Submit`++<img width="766" alt="image" src="https://github.com/user-attachments/assets/ac0cb186-8496-4c22-a249-d555dad1f870" />++**If you did everything above, you'll have two things**++1. A page token, that won't expire to manage your Instagram account. You will use the page token to setup the Facebook Graph node in n8n.+2. The Instagram account id which you'll need to set in the `Configure` node in the n8n workflowdiff --git a/episode_8/guide-supabase.md b/episode_8/guide-supabase.mdnew file mode 100644index 0000000..7e539a8--- /dev/null+++ b/episode_8/guide-supabase.md@@ -0,0 +1,58 @@+# Guide to create and setup the Supabase account++Start by heading to [Supabase](https://supabase.com/) and create a new free account.++## 1. Creating the database tables++Once the account is ready, head to the `Table Editor`.++<img width="205" alt="Screenshot 2025-05-09 at 8 49 28 AM" src="https://github.com/user-attachments/assets/03f22c7c-18d5-4de0-81e0-f4fcee127647" />++To create a new database table, click on the `New table` button.++<img width="262" alt="Screenshot 2025-05-09 at 8 49 35 AM" src="https://github.com/user-attachments/assets/2a8e59f5-d20c-470e-abc8-c15966f438c1" />++### Create the `plans` table++The plans table should have 4 fields in total++1. `id` (int8) primary, just use the default settings+2. `period_type` (text) - we are using this field to index the different periods, the possible values are: `quarter` `month` and `week`+3. `period_index` (text) - this will store the value of the `period_type` - for example `2025-Q2` for the second quarter of 2025+4. `plan_value` (text) - the actual value of the plan for the given period++<img width="664" alt="Screenshot 2025-05-09 at 8 43 17 AM" src="https://github.com/user-attachments/assets/d308dd34-8fde-4cd4-8347-d2e97db1d648" />++Once ready, hit save.++### Create the `posts` table++1. `id` (int8) primary, just use the default settings+2. `created_at` (timestamp) default value `now()`+3. `post_summary` (text) - we'll store the summary of each posts for consistent posts+4. `image_path` (text) - the path of the generated image we uploaded to the Supabase storage bucket++<img width="663" alt="Screenshot 2025-05-09 at 8 43 33 AM" src="https://github.com/user-attachments/assets/917d2556-eb3d-48a1-9095-65332882fd0c" />++## Creating the storage bucket++Click on `Storage` from the menu.++<img width="200" alt="Screenshot 2025-05-09 at 9 00 15 AM" src="https://github.com/user-attachments/assets/e7cbd532-b7bd-4404-a169-2965932be24e" />++Click on `New bucket`.++<img width="242" alt="Screenshot 2025-05-09 at 9 00 21 AM" src="https://github.com/user-attachments/assets/9deca74e-1798-4733-8593-0b5593857ab4" />++Name your bucket `instagram-images` or anything that fits the naming criteria - but remember the name as you'll need to set it in n8n.++<img width="522" alt="Screenshot 2025-05-09 at 9 01 11 AM" src="https://github.com/user-attachments/assets/10cf6666-63bb-4bdc-abcc-2a0fad7e27da" />++Now, you can upload the reference image to the bucket by clicking on the `Upload files` button.++<img width="831" alt="Screenshot 2025-05-09 at 9 02 07 AM" src="https://github.com/user-attachments/assets/6cc83262-b92c-4f74-86c3-a45c9c0456f8" />++This is it, your Supabase account is ready to be used.+++diff --git a/episode_8/instagram_ai_influencer.json b/episode_8/instagram_ai_influencer.jsonnew file mode 100644index 0000000..65cb4bf--- /dev/null+++ b/episode_8/instagram_ai_influencer.json@@ -0,0 +1,2164 @@+{+ "name": "Episode 8: Instagram influencer",+ "nodes": [+ {+ "parameters": {},+ "type": "n8n-nodes-base.manualTrigger",+ "typeVersion": 1,+ "position": [+ -620,+ 840+ ],+ "id": "05123d37-3b5f-4e69-a2a8-a7ba379c882e",+ "name": "When clicking ‘Test workflow’"+ },+ {+ "parameters": {+ "assignments": {+ "assignments": [+ {+ "id": "116298a2-1008-4c7c-839a-dddecb29d8d2",+ "name": "SUPABASE_PROJECT_ID",+ "value": "ADD_YOURS",+ "type": "string"+ },+ {+ "id": "8d0ca179-9bdd-4ad8-aa38-13e81f572122",+ "name": "SUPABASE_BUCKET_NAME",+ "value": "instagram-images",+ "type": "string"+ },+ {+ "id": "16a4a274-a729-44d5-a8a4-f99587535345",+ "name": "INSTAGRAM_BUSINESS_ACCOUNT_ID",+ "value": "ADD_YOURS",+ "type": "string"+ },+ {+ "id": "f4e2138a-bfb8-407b-ac18-36efe67ec2d7",+ "name": "EMAIL_ADDRESS",+ "value": "ADD_YOURS",+ "type": "string"+ },+ {+ "id": "c7a51a3e-5c97-42b1-b276-af5efa000035",+ "name": "REFERENCE_IMAGE",+ "value": "reference_image.png",+ "type": "string"+ },+ {+ "id": "26e82c19-e1ae-463b-8930-20a9b72d17f5",+ "name": "PROFILE",+ "value": "=- Name: Addi\n- Age: 28\n- Profession: Nature photographer\n- What she does\n - Travels around the globe to photograph natural sites\n - Shares educational facts about nature and wildlife\n - Presenter\n- Typical posts\n - Taking photos / being in nature\n - Research packing for trip (with computer, camera equipment)\n - Dressed up / speaking at an event\n - Watching sunrise / sunset\n- Appearance\n - Eurasian (purposefully ambiguous)\n - Medium length brown hair, brown eyes\n - Tanned skin\n- Dress\n - Collared short-sleeve shirts, shorts, white or tan\n - Plain T-shirts and long pants\n\nInspired by \n- David Attenborough\n - British host, biologist, natural historian, writer\n - Advocacy: conservation, ecology\n- Robert Irwin",+ "type": "string"+ },+ {+ "id": "2f40e267-a0ba-411f-b0c2-ac50b65ada56",+ "name": "CURRENT_QUARTER",+ "value": "=Q{{ $now.format('q') }}",+ "type": "string"+ },+ {+ "id": "37e37860-24a3-4d61-b953-de23ef9ce0b5",+ "name": "WEEK",+ "value": "={{ $now.startOf('week').format('MMMM dd') }} ({{ $now.startOf('week').format('EEEE') }}) - {{ $now.endOf('week').format('MMMM dd') }} ({{ $now.endOf('week').format('EEEE') }})",+ "type": "string"+ }+ ]+ },+ "options": {}+ },+ "type": "n8n-nodes-base.set",+ "typeVersion": 3.4,+ "position": [+ -100,+ 840+ ],+ "id": "827e13c1-a1aa-4054-a47f-c298465b2b55",+ "name": "Configure workflow"+ },+ {+ "parameters": {+ "assignments": {+ "assignments": [+ {+ "id": "c57d6fe3-c7f3-4fd9-85f2-e9e54cd59840",+ "name": "change_requests",+ "value": "={{ $json.data['Change requests'] }}",+ "type": "string"+ },+ {+ "id": "8cc398cd-70db-4c91-934f-14fac2e38e27",+ "name": "quarterly_plan",+ "value": "={{ $('Generate quarterly plan').item.json.output.quarterly_plan }}",+ "type": "string"+ }+ ]+ },+ "options": {}+ },+ "type": "n8n-nodes-base.set",+ "typeVersion": 3.4,+ "position": [+ 1920,+ 720+ ],+ "id": "f85faf63-741c-479c-9b14-94c5e65d752d",+ "name": "Change request fields"+ },+ {+ "parameters": {+ "content": "# Create quarterly plan",+ "height": 600,+ "width": 1860+ },+ "type": "n8n-nodes-base.stickyNote",+ "typeVersion": 1,+ "position": [+ 260,+ 600+ ],+ "id": "f2f0fc83-8f91-4bb4-8037-1750fa26928b",+ "name": "Sticky Note"+ },+ {+ "parameters": {+ "operation": "get",+ "tableId": "plans",+ "filters": {+ "conditions": [+ {+ "keyName": "period_type",+ "keyValue": "month"+ },+ {+ "keyName": "period_type",+ "keyValue": "month"+ },+ {+ "keyName": "period_index",+ "keyValue": "={{ $now.format('yyyy/MMMM') }}"+ }+ ]+ }+ },+ "type": "n8n-nodes-base.supabase",+ "typeVersion": 1,+ "position": [+ 360,+ 1420+ ],+ "id": "ea113960-0d2f-4a24-88a6-a80f0b391e29",+ "name": "Get monthly plan",+ "alwaysOutputData": true,+ "credentials": {+ "supabaseApi": {+ "id": "bCDwKXFDdP3ZISkr",+ "name": "Supabase - 2rum2room2"+ }+ }+ },+ {+ "parameters": {+ "assignments": {+ "assignments": [+ {+ "id": "c57d6fe3-c7f3-4fd9-85f2-e9e54cd59840",+ "name": "change_requests",+ "value": "={{ $json.data['Change requests'] }}",+ "type": "string"+ },+ {+ "id": "8cc398cd-70db-4c91-934f-14fac2e38e27",+ "name": "monthly_plan",+ "value": "={{ $('Generate monthly plan').item.json.output.monthly_plan }}",+ "type": "string"+ }+ ]+ },+ "options": {}+ },+ "type": "n8n-nodes-base.set",+ "typeVersion": 3.4,+ "position": [+ 1900,+ 1420+ ],+ "id": "9f658870-a229-449d-8751-7b95da068f75",+ "name": "Change request fields1"+ },+ {+ "parameters": {+ "conditions": {+ "options": {+ "caseSensitive": true,+ "leftValue": "",+ "typeValidation": "strict",+ "version": 2+ },+ "conditions": [+ {+ "id": "a753a22c-2595-4c88-8438-63102a03d113",+ "leftValue": "={{ $json.data['Approve the monthly plan?'] }}",+ "rightValue": "yes",+ "operator": {+ "type": "string",+ "operation": "equals",+ "name": "filter.operator.equals"+ }+ }+ ],+ "combinator": "and"+ },+ "options": {}+ },+ "type": "n8n-nodes-base.if",+ "typeVersion": 2.2,+ "position": [+ 1720,+ 1420+ ],+ "id": "27c5e1e7-d4d8-4d40-9f53-41cfea576e82",+ "name": "Need changes?1"+ },+ {+ "parameters": {+ "content": "# Create monthly plan",+ "height": 620,+ "width": 1860+ },+ "type": "n8n-nodes-base.stickyNote",+ "typeVersion": 1,+ "position": [+ 260,+ 1280+ ],+ "id": "14e5f603-c1fc-4539-88c8-693f0f8cde62",+ "name": "Sticky Note1"+ },+ {+ "parameters": {+ "conditions": {+ "options": {+ "caseSensitive": true,+ "leftValue": "",+ "typeValidation": "strict",+ "version": 2+ },+ "conditions": [+ {+ "id": "ad1608d1-c4f1-40a0-a17b-f50f922c07a2",+ "leftValue": "={{ $json.data[0] }}",+ "rightValue": "",+ "operator": {+ "type": "object",+ "operation": "notEmpty",+ "singleValue": true+ }+ }+ ],+ "combinator": "and"+ },+ "options": {}+ },+ "type": "n8n-nodes-base.if",+ "typeVersion": 2.2,+ "position": [+ 740,+ 1420+ ],+ "id": "337fb8f4-2192-4896-acee-7adaa0945a3b",+ "name": "Has monthly plan?"+ },+ {+ "parameters": {+ "operation": "sendAndWait",+ "sendTo": "={{ $('Configure workflow').item.json.EMAIL_ADDRESS }}",+ "subject": "=[Action required] Create monthly plan for {{ $now.toFormat('yyyy/MMMM') }}",+ "message": "=Add instructions to create the monthly plan for {{ $now.toFormat('yyyy/MMMM') }}\n\nAs a reminder, here's the plan for {{ $now.format('yyyy') }}-{{ $('Configure workflow').item.json.CURRENT_QUARTER }}:\n\n{{ $('Quaterly plan aggregate').item.json.data[0].plan_value }}",+ "responseType": "customForm",+ "formFields": {+ "values": [+ {+ "fieldLabel": "Instructions",+ "fieldType": "textarea",+ "placeholder": "Instructions for the monthly plan",+ "requiredField": true+ }+ ]+ },+ "options": {+ "messageButtonLabel": "Create monthly plan"+ }+ },+ "type": "n8n-nodes-base.gmail",+ "typeVersion": 2.1,+ "position": [+ 940,+ 1420+ ],+ "id": "2fde5405-919f-41c6-bfd9-94d046b78fb8",+ "name": "Get instructions on the monthly plan",+ "webhookId": "03a0b1ff-a665-4657-9fa2-e43aaa7e59ad",+ "credentials": {+ "gmailOAuth2": {+ "id": "oejgkhJaqXMO3oAP",+ "name": "Gmail account real"+ }+ }+ },+ {+ "parameters": {+ "operation": "sendAndWait",+ "sendTo": "={{ $('Configure workflow').item.json.EMAIL_ADDRESS }}",+ "subject": "=[action required] Approve monthly plan for {{ $now.format('yyyy/MMMM') }}",+ "message": "=The following monthly plan was generated for {{ $now.format('yyyy/MMMM') }}, please approve or ask for changes\n\n{{ $json.output.monthly_plan }}",+ "responseType": "customForm",+ "formFields": {+ "values": [+ {+ "fieldLabel": "Approve the monthly plan?",+ "fieldType": "dropdown",+ "fieldOptions": {+ "values": [+ {+ "option": "yes"+ },+ {+ "option": "no - I'll add my change requests below"+ }+ ]+ },+ "requiredField": true+ },+ {+ "fieldLabel": "Change requests",+ "fieldType": "textarea",+ "placeholder": "(optional) Add your change requests"+ }+ ]+ },+ "options": {}+ },+ "type": "n8n-nodes-base.gmail",+ "typeVersion": 2.1,+ "position": [+ 1520,+ 1420+ ],+ "id": "63e7a2c6-7fed-4aca-82a5-b575fd1f51df",+ "name": "Montly plan approval",+ "webhookId": "08e878d2-3f61-45b5-9b90-e06f96f632ad",+ "credentials": {+ "gmailOAuth2": {+ "id": "oejgkhJaqXMO3oAP",+ "name": "Gmail account real"+ }+ }+ },+ {+ "parameters": {+ "tableId": "plans",+ "fieldsUi": {+ "fieldValues": [+ {+ "fieldId": "period_type",+ "fieldValue": "month"+ },+ {+ "fieldId": "period_index",+ "fieldValue": "={{ $now.format('yyyy/MMMM') }}"+ },+ {+ "fieldId": "plan_value",+ "fieldValue": "={{ $('Generate monthly plan').item.json.output.monthly_plan }}"+ }+ ]+ }+ },+ "type": "n8n-nodes-base.supabase",+ "typeVersion": 1,+ "position": [+ 1900,+ 1640+ ],+ "id": "3dc4eb23-31a4-4e77-a9ee-3b0e179a4e45",+ "name": "Save monthly plan",+ "credentials": {+ "supabaseApi": {+ "id": "bCDwKXFDdP3ZISkr",+ "name": "Supabase - 2rum2room2"+ }+ }+ },+ {+ "parameters": {+ "content": "# Create weekly plan",+ "height": 580,+ "width": 1860+ },+ "type": "n8n-nodes-base.stickyNote",+ "typeVersion": 1,+ "position": [+ 260,+ 1980+ ],+ "id": "0adc78f8-d6d9-4628-8111-72f35a98a3c2",+ "name": "Sticky Note2"+ },+ {+ "parameters": {+ "operation": "get",+ "tableId": "plans",+ "filters": {+ "conditions": [+ {+ "keyName": "period_type",+ "keyValue": "week"+ },+ {+ "keyName": "period_index",+ "keyValue": "={{ $now.format('yyyy/week-WW') }}"+ }+ ]+ }+ },+ "type": "n8n-nodes-base.supabase",+ "typeVersion": 1,+ "position": [+ 360,+ 2080+ ],+ "id": "1bbf3c31-4ceb-45c5-9936-ece7a8c601a2",+ "name": "Get weekly plan",+ "retryOnFail": false,+ "alwaysOutputData": true,+ "credentials": {+ "supabaseApi": {+ "id": "bCDwKXFDdP3ZISkr",+ "name": "Supabase - 2rum2room2"+ }+ }+ },+ {+ "parameters": {+ "conditions": {+ "options": {+ "caseSensitive": true,+ "leftValue": "",+ "typeValidation": "strict",+ "version": 2+ },+ "conditions": [+ {+ "id": "b728c77c-a939-4388-b8b7-9465b5243ee0",+ "leftValue": "={{ $json.data[0] }}",+ "rightValue": "",+ "operator": {+ "type": "object",+ "operation": "notEmpty",+ "singleValue": true+ }+ }+ ],+ "combinator": "and"+ },+ "options": {}+ },+ "type": "n8n-nodes-base.if",+ "typeVersion": 2.2,+ "position": [+ 740,+ 2080+ ],+ "id": "d165815f-af6e-475e-addb-b85d2f35e12b",+ "name": "Has weekly plan?"+ },+ {+ "parameters": {+ "operation": "sendAndWait",+ "sendTo": "={{ $('Configure workflow').item.json.EMAIL_ADDRESS }}",+ "subject": "=[Action required] Create weekly plan for {{ $('Configure workflow').item.json.WEEK }}",+ "message": "=Add instructions to create the weekly plan for {{ $('Configure workflow').item.json.WEEK }}\n\nAs a reminder, here's the {{ $now.format('yyyy') }}-{{ $('Configure workflow').item.json.CURRENT_QUARTER }} plan:\n\n{{ $('Quaterly plan aggregate').item.json.data[0].plan_value }}\n\nAnd this is the monthly plan:\n\n{{ $('Monthly plan aggregate').item.json.data[0].plan_value }}",+ "responseType": "customForm",+ "formFields": {+ "values": [+ {+ "fieldLabel": "Instructions",+ "fieldType": "textarea",+ "placeholder": "Instructions for the weekly plan",+ "requiredField": true+ }+ ]+ },+ "options": {+ "messageButtonLabel": "Create weekly plan"+ }+ },+ "type": "n8n-nodes-base.gmail",+ "typeVersion": 2.1,+ "position": [+ 940,+ 2080+ ],+ "id": "8750563d-51ce-4a3b-9b80-a739cedcc6db",+ "name": "Get instructions on the weekly plan",+ "webhookId": "03a0b1ff-a665-4657-9fa2-e43aaa7e59ad",+ "credentials": {+ "gmailOAuth2": {+ "id": "oejgkhJaqXMO3oAP",+ "name": "Gmail account real"+ }+ }+ },+ {+ "parameters": {+ "operation": "sendAndWait",+ "sendTo": "={{ $('Configure workflow').item.json.EMAIL_ADDRESS }}",+ "subject": "=[action required] Approve weekly plan for {{ $('Configure workflow').item.json.WEEK }}",+ "message": "=The following weekly plan was generated for {{ $('Configure workflow').item.json.WEEK }}, please approve or ask for changes\n\n{{ $json.output.weekly_plan }}",+ "responseType": "customForm",+ "formFields": {+ "values": [+ {+ "fieldLabel": "Approve the weekly plan?",+ "fieldType": "dropdown",+ "fieldOptions": {+ "values": [+ {+ "option": "yes"+ },+ {+ "option": "no - I'll add my change requests below"+ }+ ]+ },+ "requiredField": true+ },+ {+ "fieldLabel": "Change requests",+ "fieldType": "textarea",+ "placeholder": "(optional) Add your change requests"+ }+ ]+ },+ "options": {}+ },+ "type": "n8n-nodes-base.gmail",+ "typeVersion": 2.1,+ "position": [+ 1460,+ 2080+ ],+ "id": "bfd8c01c-5715-4825-8c89-47ea38562161",+ "name": "Weekly plan approval",+ "webhookId": "08e878d2-3f61-45b5-9b90-e06f96f632ad",+ "credentials": {+ "gmailOAuth2": {+ "id": "oejgkhJaqXMO3oAP",+ "name": "Gmail account real"+ }+ }+ },+ {+ "parameters": {+ "conditions": {+ "options": {+ "caseSensitive": true,+ "leftValue": "",+ "typeValidation": "strict",+ "version": 2+ },+ "conditions": [+ {+ "id": "a753a22c-2595-4c88-8438-63102a03d113",+ "leftValue": "={{ $json.data['Approve the weekly plan?'] }}",+ "rightValue": "yes",+ "operator": {+ "type": "string",+ "operation": "equals",+ "name": "filter.operator.equals"+ }+ }+ ],+ "combinator": "and"+ },+ "options": {}+ },+ "type": "n8n-nodes-base.if",+ "typeVersion": 2.2,+ "position": [+ 1640,+ 2080+ ],+ "id": "8292a83d-137d-4569-ac5b-3e7a60defeaa",+ "name": "Changes to the weekly plan?"+ },+ {+ "parameters": {+ "assignments": {+ "assignments": [+ {+ "id": "c57d6fe3-c7f3-4fd9-85f2-e9e54cd59840",+ "name": "change_requests",+ "value": "={{ $json.data['Change requests'] }}",+ "type": "string"+ },+ {+ "id": "8cc398cd-70db-4c91-934f-14fac2e38e27",+ "name": "weekly_plan",+ "value": "={{ $('Generate weekly plan').item.json.output.weekly_plan }}",+ "type": "string"+ }+ ]+ },+ "options": {}+ },+ "type": "n8n-nodes-base.set",+ "typeVersion": 3.4,+ "position": [+ 1820,+ 2080+ ],+ "id": "74f075b3-cae0-424e-b38b-733fd6d6d6b9",+ "name": "Weekly plan change fields"+ },+ {+ "parameters": {+ "tableId": "plans",+ "fieldsUi": {+ "fieldValues": [+ {+ "fieldId": "period_type",+ "fieldValue": "week"+ },+ {+ "fieldId": "period_index",+ "fieldValue": "={{ $now.format('yyyy/week-WW') }}"+ },+ {+ "fieldId": "plan_value",+ "fieldValue": "={{ $('Generate weekly plan').item.json.output.weekly_plan }}"+ }+ ]+ }+ },+ "type": "n8n-nodes-base.supabase",+ "typeVersion": 1,+ "position": [+ 1820,+ 2300+ ],+ "id": "38579531-f529-4ea2-b96f-5ceb110a6784",+ "name": "Save weekly plan",+ "credentials": {+ "supabaseApi": {+ "id": "bCDwKXFDdP3ZISkr",+ "name": "Supabase - 2rum2room2"+ }+ }+ },+ {+ "parameters": {+ "aggregate": "aggregateAllItemData",+ "options": {}+ },+ "type": "n8n-nodes-base.aggregate",+ "typeVersion": 1,+ "position": [+ 560,+ 2840+ ],+ "id": "21103a1f-0536-4e4e-bac5-4945e30a27c9",+ "name": "merge previous week's posts"+ },+ {+ "parameters": {+ "method": "POST",+ "url": "https://api.openai.com/v1/images/edits",+ "authentication": "predefinedCredentialType",+ "nodeCredentialType": "openAiApi",+ "sendHeaders": true,+ "headerParameters": {+ "parameters": [+ {}+ ]+ },+ "sendBody": true,+ "contentType": "multipart-form-data",+ "bodyParameters": {+ "parameters": [+ {+ "name": "prompt",+ "value": "={{ $('Generate new Instagram post').item.json.output.image_prompt }}"+ },+ {+ "parameterType": "formBinaryData",+ "name": "image",+ "inputDataFieldName": "data"+ },+ {+ "name": "model",+ "value": "gpt-image-1"+ },+ {+ "name": "quality",+ "value": "high"+ },+ {+ "name": "size",+ "value": "1024x1024"+ },+ {+ "name": "output_format",+ "value": "jpeg"+ },+ {+ "name": "output_compression",+ "value": "80"+ }+ ]+ },+ "options": {}+ },+ "type": "n8n-nodes-base.httpRequest",+ "typeVersion": 4.2,+ "position": [+ 1500,+ 2840+ ],+ "id": "e3a4d033-294d-42b4-b9d4-1fcf20a51481",+ "name": "Generate image with OpenAI",+ "credentials": {+ "openAiApi": {+ "id": "tGvJRP2th9CbI2oq",+ "name": "OpenAi account 2"+ }+ }+ },+ {+ "parameters": {+ "operation": "toBinary",+ "sourceProperty": "data[0].b64_json",+ "options": {}+ },+ "type": "n8n-nodes-base.convertToFile",+ "typeVersion": 1.1,+ "position": [+ 1700,+ 2840+ ],+ "id": "7c426834-b476-4813-9436-99a64e2cee15",+ "name": "Convert response to image"+ },+ {+ "parameters": {+ "assignments": {+ "assignments": [+ {+ "id": "adef3034-fabf-4616-b45a-fdd262318229",+ "name": "share_link",+ "value": "=https://{{ $('Configure workflow').item.json.SUPABASE_PROJECT_ID }}.supabase.co/storage/v1/object/public/{{ $('Configure workflow').item.json.SUPABASE_BUCKET_NAME }}/{{ $('Generate unique id').item.json.image_id }}.jpg",+ "type": "string"+ }+ ]+ },+ "options": {}+ },+ "type": "n8n-nodes-base.set",+ "typeVersion": 3.4,+ "position": [+ 2100,+ 2840+ ],+ "id": "08456ecb-fa12-4e1e-bf40-06a92960de05",+ "name": "Add share link"+ },+ {+ "parameters": {+ "operation": "sendAndWait",+ "sendTo": "={{ $('Configure workflow').item.json.EMAIL_ADDRESS }}",+ "subject": "=[Action required] Approve Instagram post {{ $now.toLocaleString() }}",+ "message": "=Image: <a target=\"_blank\" href=\"{{ $json.share_link }}\">Generated Instagram image</a>\n\nPost content:\n\n{{ $('Generate new Instagram post').item.json.output.post_content }}",+ "responseType": "customForm",+ "formFields": {+ "values": [+ {+ "fieldLabel": "Approve?",+ "fieldType": "dropdown",+ "fieldOptions": {+ "values": [+ {+ "option": "yes"+ },+ {+ "option": "no - I'll add my change requests below"+ }+ ]+ },+ "requiredField": true+ },+ {+ "fieldLabel": "Change requests",+ "fieldType": "textarea",+ "placeholder": "(optional) Change requests for the Instagram post"+ }+ ]+ },+ "options": {}+ },+ "type": "n8n-nodes-base.gmail",+ "typeVersion": 2.1,+ "position": [+ 2300,+ 2840+ ],+ "id": "efc0b271-2ce3-4db4-9991-1c65593107c8",+ "name": "Get approval for the post",+ "webhookId": "728f8049-2461-4c13-af6d-468328d16020",+ "credentials": {+ "gmailOAuth2": {+ "id": "E1ofNfqugb4UykcT",+ "name": "Gmail 2rum2room2"+ }+ }+ },+ {+ "parameters": {+ "conditions": {+ "options": {+ "caseSensitive": true,+ "leftValue": "",+ "typeValidation": "strict",+ "version": 2+ },+ "conditions": [+ {+ "id": "82e9c4ea-904d-4497-adef-ffa55082837a",+ "leftValue": "={{ $json.data['Approve?'] }}",+ "rightValue": "yes",+ "operator": {+ "type": "string",+ "operation": "equals",+ "name": "filter.operator.equals"+ }+ }+ ],+ "combinator": "and"+ },+ "options": {}+ },+ "type": "n8n-nodes-base.if",+ "typeVersion": 2.2,+ "position": [+ 360,+ 3180+ ],+ "id": "5e1f5ab0-8638-48d1-bcec-60d7b9047d44",+ "name": "Post approved?"+ },+ {+ "parameters": {+ "assignments": {+ "assignments": [+ {+ "id": "2c107111-1aa6-4525-9667-1b979b4cb7be",+ "name": "post_content",+ "value": "={{ $('Generate new Instagram post').item.json.output.post_content }}",+ "type": "string"+ },+ {+ "id": "fd281099-1fc1-42dd-93b2-22301e9c502f",+ "name": "image_prompt",+ "value": "={{ $('Generate new Instagram post').item.json.output.image_prompt }}",+ "type": "string"+ },+ {+ "id": "b3c122e9-a3f0-4595-8d3d-1b62a4a1dfca",+ "name": "change_requests",+ "value": "={{ $('Post approved?').item.json.data['Change requests'] }}",+ "type": "string"+ }+ ]+ },+ "options": {}+ },+ "type": "n8n-nodes-base.set",+ "typeVersion": 3.4,+ "position": [+ 580,+ 3180+ ],+ "id": "24c86689-d3e0-4741-a1cc-f92fbb4fc3e5",+ "name": "Add post change request fields"+ },+ {+ "parameters": {+ "httpRequestMethod": "POST",+ "graphApiVersion": "v22.0",+ "node": "17841474225498078",+ "edge": "media",+ "options": {+ "queryParameters": {+ "parameter": [+ {+ "name": "image_url",+ "value": "={{ $('Add share link').item.json.share_link }}"+ },+ {+ "name": "caption",+ "value": "={{ $('Generate new Instagram post').item.json.output.post_content }}"+ }+ ]+ }+ }+ },+ "type": "n8n-nodes-base.facebookGraphApi",+ "typeVersion": 1,+ "position": [+ 360,+ 3860+ ],+ "id": "5e13b93a-f830-469e-993e-e52de012fade",+ "name": "Facebook Graph API",+ "credentials": {+ "facebookGraphApi": {+ "id": "6QYA8nXTfX9mWQr4",+ "name": "Facebook Graph account"+ }+ }+ },+ {+ "parameters": {+ "action": "generate",+ "dataPropertyName": "image_id"+ },+ "type": "n8n-nodes-base.crypto",+ "typeVersion": 1,+ "position": [+ 1100,+ 2840+ ],+ "id": "3a220608-f5bf-4387-90d5-1727a2201489",+ "name": "Generate unique id"+ },+ {+ "parameters": {+ "method": "POST",+ "url": "=https://{{ $('Configure workflow').item.json.SUPABASE_PROJECT_ID }}.supabase.co/storage/v1/object/{{ $('Configure workflow').item.json.SUPABASE_BUCKET_NAME }}/{{ $('Generate unique id').item.json.image_id }}.jpg",+ "authentication": "predefinedCredentialType",+ "nodeCredentialType": "supabaseApi",+ "sendBody": true,+ "contentType": "multipart-form-data",+ "bodyParameters": {+ "parameters": [+ {+ "parameterType": "formBinaryData",+ "name": "file",+ "inputDataFieldName": "data"+ }+ ]+ },+ "options": {+ "response": {+ "response": {+ "fullResponse": true+ }+ }+ }+ },+ "type": "n8n-nodes-base.httpRequest",+ "typeVersion": 4.2,+ "position": [+ 1900,+ 2840+ ],+ "id": "d5f6ec7e-e29a-434d-a29c-85a961325006",+ "name": "Upload image to Supabase",+ "credentials": {+ "supabaseApi": {+ "id": "bCDwKXFDdP3ZISkr",+ "name": "Supabase - 2rum2room2"+ }+ }+ },+ {+ "parameters": {+ "httpRequestMethod": "POST",+ "graphApiVersion": "v22.0",+ "node": "17841474225498078",+ "edge": "media_publish",+ "options": {+ "queryParameters": {+ "parameter": [+ {+ "name": "creation_id",+ "value": "={{ $json.id }}"+ }+ ]+ }+ }+ },+ "type": "n8n-nodes-base.facebookGraphApi",+ "typeVersion": 1,+ "position": [+ 560,+ 3860+ ],+ "id": "ea13dfd1-dfd9-494d-a39c-554732cf8c67",+ "name": "Facebook Graph API1",+ "credentials": {+ "facebookGraphApi": {+ "id": "6QYA8nXTfX9mWQr4",+ "name": "Facebook Graph account"+ }+ }+ },+ {+ "parameters": {+ "operation": "sendAndWait",+ "sendTo": "={{ $('Configure workflow').item.json.EMAIL_ADDRESS }}",+ "subject": "=[Action required] Create quarterly plan for {{ $now.format('yyyy') }} {{ $('Configure workflow').item.json.CURRENT_QUARTER }}",+ "message": "=Add instructions to create the quarterly plan for {{ $now.format('yyyy') }} {{ $('Configure workflow').item.json.CURRENT_QUARTER }}",+ "responseType": "customForm",+ "formFields": {+ "values": [+ {+ "fieldLabel": "Instructions",+ "fieldType": "textarea",+ "placeholder": "=Instructions for {{ $now.format('yyyy') }} {{ $('Configure workflow').item.json.CURRENT_QUARTER }} plan",+ "requiredField": true+ }+ ]+ },+ "options": {+ "messageButtonLabel": "=Create {{ $now.format('yyyy') }} {{ $('Configure workflow').item.json.CURRENT_QUARTER }} plan"+ }+ },+ "type": "n8n-nodes-base.gmail",+ "typeVersion": 2.1,+ "position": [+ 940,+ 720+ ],+ "id": "6807bd28-670a-4818-aa41-644933adf442",+ "name": "Get instructions on the quarterly plan",+ "webhookId": "03a0b1ff-a665-4657-9fa2-e43aaa7e59ad",+ "credentials": {+ "gmailOAuth2": {+ "id": "E1ofNfqugb4UykcT",+ "name": "Gmail 2rum2room2"+ }+ }+ },+ {+ "parameters": {+ "conditions": {+ "options": {+ "caseSensitive": true,+ "leftValue": "",+ "typeValidation": "strict",+ "version": 2+ },+ "conditions": [+ {+ "id": "e2eb3395-ad04-4360-a855-7922a2534582",+ "leftValue": "={{ $json.data[0] }}",+ "rightValue": "",+ "operator": {+ "type": "object",+ "operation": "notEmpty",+ "singleValue": true+ }+ }+ ],+ "combinator": "and"+ },+ "options": {}+ },+ "type": "n8n-nodes-base.if",+ "typeVersion": 2.2,+ "position": [+ 720,+ 720+ ],+ "id": "7c38a9b2-5bb3-4f31-abbe-8c558e1dd39b",+ "name": "Has quarterly plan?"+ },+ {+ "parameters": {+ "operation": "get",+ "tableId": "plans",+ "filters": {+ "conditions": [+ {+ "keyName": "period_type",+ "keyValue": "quarter"+ },+ {+ "keyName": "period_index",+ "keyValue": "={{ $now.toFormat('yyyy') }}-{{ $('Configure workflow').item.json.CURRENT_QUARTER }}"+ }+ ]+ }+ },+ "type": "n8n-nodes-base.supabase",+ "typeVersion": 1,+ "position": [+ 340,+ 720+ ],+ "id": "1905495e-b122-49b0-b063-bc66e18e59d3",+ "name": "Get quarterly plan",+ "alwaysOutputData": true,+ "credentials": {+ "supabaseApi": {+ "id": "bCDwKXFDdP3ZISkr",+ "name": "Supabase - 2rum2room2"+ }+ }+ },+ {+ "parameters": {+ "operation": "sendAndWait",+ "sendTo": "={{ $('Configure workflow').item.json.EMAIL_ADDRESS }}",+ "subject": "=[action required] Approve plan for {{ $now.format('yyyy') }}-{{ $('Configure workflow').item.json.CURRENT_QUARTER }}",+ "message": "=The following yearly plan was generated, please approve or ask for changes\n\n{{ $json.output.quarterly_plan }}",+ "responseType": "customForm",+ "formFields": {+ "values": [+ {+ "fieldLabel": "=Do you approve the plan?",+ "fieldType": "dropdown",+ "fieldOptions": {+ "values": [+ {+ "option": "yes"+ },+ {+ "option": "no - I'll add my change requests below"+ }+ ]+ },+ "requiredField": true+ },+ {+ "fieldLabel": "Change requests",+ "fieldType": "textarea",+ "placeholder": "(optional) Add your change requests"+ }+ ]+ },+ "options": {}+ },+ "type": "n8n-nodes-base.gmail",+ "typeVersion": 2.1,+ "position": [+ 1520,+ 720+ ],+ "id": "f802e0ff-c49d-4bdb-be39-fc2647549a86",+ "name": "Get approval on the quarterly plan",+ "webhookId": "08e878d2-3f61-45b5-9b90-e06f96f632ad",+ "credentials": {+ "gmailOAuth2": {+ "id": "oejgkhJaqXMO3oAP",+ "name": "Gmail account real"+ }+ }+ },+ {+ "parameters": {+ "tableId": "plans",+ "fieldsUi": {+ "fieldValues": [+ {+ "fieldId": "period_type",+ "fieldValue": "quarter"+ },+ {+ "fieldId": "period_index",+ "fieldValue": "={{ $now.toFormat('yyyy') }}-{{ $('Configure workflow').item.json.CURRENT_QUARTER }}"+ },+ {+ "fieldId": "plan_value",+ "fieldValue": "={{ $('Generate quarterly plan').item.json.output.quarterly_plan }}"+ }+ ]+ }+ },+ "type": "n8n-nodes-base.supabase",+ "typeVersion": 1,+ "position": [+ 1920,+ 940+ ],+ "id": "017d5b8f-26f9-4abe-8405-b2de27586554",+ "name": "Save quarterly plan",+ "credentials": {+ "supabaseApi": {+ "id": "bCDwKXFDdP3ZISkr",+ "name": "Supabase - 2rum2room2"+ }+ }+ },+ {+ "parameters": {+ "url": "=https://{{ $('Configure workflow').item.json.SUPABASE_PROJECT_ID }}.supabase.co/storage/v1/object/public/{{ $('Configure workflow').item.json.SUPABASE_BUCKET_NAME }}/{{ $('Configure workflow').item.json.REFERENCE_IMAGE }}",+ "options": {}+ },+ "type": "n8n-nodes-base.httpRequest",+ "typeVersion": 4.2,+ "position": [+ 1300,+ 2840+ ],+ "id": "491d1bf6-77c8-4259-ad95-9377a9825988",+ "name": "Download the reference image"+ },+ {+ "parameters": {+ "operation": "getAll",+ "tableId": "posts",+ "returnAll": true,+ "filters": {+ "conditions": [+ {+ "keyName": "created_at",+ "condition": "gte",+ "keyValue": "={{ $now.minus(1, 'week') }}"+ }+ ]+ }+ },+ "type": "n8n-nodes-base.supabase",+ "typeVersion": 1,+ "position": [+ 360,+ 2840+ ],+ "id": "1e2f134c-e6a0-4956-8de7-006556fc632b",+ "name": "Get posts from the past 7 days",+ "alwaysOutputData": true,+ "credentials": {+ "supabaseApi": {+ "id": "bCDwKXFDdP3ZISkr",+ "name": "Supabase - 2rum2room2"+ }+ }+ },+ {+ "parameters": {+ "content": "# Post to instagram\n# [Guide to setup Facebook (Instagram)](https://github.com/gyoridavid/ai_agents_az/blob/main/episode_8/guide-instagram.md)",+ "height": 500,+ "width": 640,+ "color": 4+ },+ "type": "n8n-nodes-base.stickyNote",+ "typeVersion": 1,+ "position": [+ 280,+ 3680+ ],+ "id": "04c78cf5-0b9f-4a1b-9667-926e25571c38",+ "name": "Sticky Note3"+ },+ {+ "parameters": {+ "content": "# Create a new instagram post",+ "height": 960,+ "width": 2240,+ "color": 5+ },+ "type": "n8n-nodes-base.stickyNote",+ "typeVersion": 1,+ "position": [+ 260,+ 2660+ ],+ "id": "8b570755-9a80-47d2-b6d8-e40722b9f686",+ "name": "Sticky Note4"+ },+ {+ "parameters": {+ "content": "# Configure!",+ "height": 600,+ "width": 400,+ "color": 3+ },+ "type": "n8n-nodes-base.stickyNote",+ "typeVersion": 1,+ "position": [+ -220,+ 600+ ],+ "id": "658c6ec0-de21-4b4d-91ae-cad159631310",+ "name": "Sticky Note5"+ },+ {+ "parameters": {+ "tableId": "posts",+ "fieldsUi": {+ "fieldValues": [+ {+ "fieldId": "post_summary",+ "fieldValue": "={{ $('Generate new Instagram post').item.json.output.summary }}"+ },+ {+ "fieldId": "image_path",+ "fieldValue": "={{ $('Configure workflow').item.json.SUPABASE_BUCKET_NAME }}/{{ $('Generate unique id').item.json.image_id }}.jpg"+ }+ ]+ }+ },+ "type": "n8n-nodes-base.supabase",+ "typeVersion": 1,+ "position": [+ 360,+ 3420+ ],+ "id": "c3d11e38-01ef-4e5a-972d-8bf1ff0879c3",+ "name": "Save the post",+ "credentials": {+ "supabaseApi": {+ "id": "bCDwKXFDdP3ZISkr",+ "name": "Supabase - 2rum2room2"+ }+ }+ },+ {+ "parameters": {+ "content": "# Use any LLM provider\n\n- ollama\n- openrouter\n- openai\n- gemini\n- ...",+ "height": 620,+ "width": 420,+ "color": 3+ },+ "type": "n8n-nodes-base.stickyNote",+ "typeVersion": 1,+ "position": [+ -220,+ 1280+ ],+ "id": "0a1774f3-a845-4bcf-b882-0d4a2233aeb0",+ "name": "Sticky Note6"+ },+ {+ "parameters": {+ "conditions": {+ "options": {+ "caseSensitive": true,+ "leftValue": "",+ "typeValidation": "strict",+ "version": 2+ },+ "conditions": [+ {+ "id": "a753a22c-2595-4c88-8438-63102a03d113",+ "leftValue": "={{ $json.data['Do you approve the plan?'] }}",+ "rightValue": "yes",+ "operator": {+ "type": "string",+ "operation": "equals",+ "name": "filter.operator.equals"+ }+ }+ ],+ "combinator": "and"+ },+ "options": {}+ },+ "type": "n8n-nodes-base.if",+ "typeVersion": 2.2,+ "position": [+ 1700,+ 720+ ],+ "id": "903ece8a-f931-48a9-8b62-b33ff9bbfa71",+ "name": "Approve quarterly plan?"+ },+ {+ "parameters": {+ "text": "=Create a social media post for this artificial person, who's sharing her life on Instagram using the instructions below.\nUse the detailed weekly plan to find what to post today. Make sure to look at the previous posts (if available) to make sure the post fits to the plan in a logical order.\n\nFor each post, generate an instagram post (text content and an image generation prompt). \nAs I'm using a reference image for the image generation, don't describe the general look of the person, and start with \"create a photorealistic image of me\", and continue with describing the scene in great detail, make it a few paragraph long. Make sure the image prompt includes \"do not add any text on the image\".\nCreate a short summary of the post for cateloging purposes.\n\n<PersonalProfile>\n{{ $('Configure workflow').item.json.PROFILE }}\n</PersonalProfile>\n\n<WeeklyPlan>\n{{ $('Weekly plan aggregate').item.json.data[0].plan_value }}\n</WeeklyPlan>\n\n<DayOfTheWeek>\n{{ $now.format('EEEE') }}\n</DayOfTheWeek>\n\n{{ !$json.data[0].isEmpty() ? `\n<PreviousPosts>\n${$json.data.map(item => `\n<Post>\n <PostedAt>${item.created_at}</PostedAt>\n <Content>${item.post_summary}</Content>\n</Post>\n`).join('\\n')}\n</PreviousPosts>\n` : '' }}\n\n{{ $json.change_requests ? `\nThe post was already generated, please apply the change requests\n\n<PostContent>\n${$json.post_content}\n</PostContent>\n\n<ImagePrompt>\n${$json.image_prompt}\n</ImagePrompt>\n\n<ChangeRequests>\n${$json.change_requests}\n</ChangeRequests>\n` : '' }}",+ "attributes": {+ "attributes": [+ {+ "name": "post_content",+ "description": "the instagram post's text content to share with the image. use emojis, hashtags",+ "required": true+ },+ {+ "name": "image_prompt",+ "description": "the image prompt to use to generate the social media image",+ "required": true+ },+ {+ "name": "summary",+ "description": "short summary of the post",+ "required": true+ }+ ]+ },+ "options": {+ "systemPromptTemplate": "You are a social media expert. Create a post for instagram based on the instructions."+ }+ },+ "type": "@n8n/n8n-nodes-langchain.informationExtractor",+ "typeVersion": 1,+ "position": [+ 760,+ 2840+ ],+ "id": "64d1130c-0587-40db-8690-3fc29ca68839",+ "name": "Generate new Instagram post"+ },+ {+ "parameters": {+ "text": "=Create a quarterly plan for {{ $now.format('yyyy') }}-{{ $('Configure workflow').item.json.CURRENT_QUARTER }} for this artificial person, who's sharing the life events on Instagram using the instructions below. Make sure it's detailed, and every month is planned out in great depth.\n\n<PersonalProfile>\n{{ $('Configure workflow').item.json.PROFILE }}\n</PersonalProfile>\n\n<Instructions>\n{{ $json.data.Instructions }}\n</Instructions>\n\n{{ $json.change_requests ? `\nThe plan was already generated, please make the requested changes.\n\n<QuarterlyPlan>\n${$json.quarterly_plan}\n</QuarterlyPlan>\n\n<ChangeRequests>\n${$json.change_requests}\n</ChangeRequests>\n` : '' }}",+ "attributes": {+ "attributes": [+ {+ "name": "quarterly_plan",+ "description": "quarterly plan in a markdows format",+ "required": true+ }+ ]+ },+ "options": {+ "systemPromptTemplate": "You are a travel planner for a famous instagram celebrity. Create a detailed plan according to the instructions."+ }+ },+ "type": "@n8n/n8n-nodes-langchain.informationExtractor",+ "typeVersion": 1,+ "position": [+ 1160,+ 720+ ],+ "id": "9e8ec2bb-d265-46e0-a6a3-80feecb2f75f",+ "name": "Generate quarterly plan"+ },+ {+ "parameters": {+ "aggregate": "aggregateAllItemData",+ "options": {}+ },+ "type": "n8n-nodes-base.aggregate",+ "typeVersion": 1,+ "position": [+ 540,+ 720+ ],+ "id": "30214202-81d1-4486-a668-7172d094f32c",+ "name": "Quaterly plan aggregate"+ },+ {+ "parameters": {+ "aggregate": "aggregateAllItemData",+ "options": {}+ },+ "type": "n8n-nodes-base.aggregate",+ "typeVersion": 1,+ "position": [+ 560,+ 1420+ ],+ "id": "80fbb9ea-113a-4c37-976d-a73a469a30e4",+ "name": "Monthly plan aggregate"+ },+ {+ "parameters": {+ "aggregate": "aggregateAllItemData",+ "options": {}+ },+ "type": "n8n-nodes-base.aggregate",+ "typeVersion": 1,+ "position": [+ 560,+ 2080+ ],+ "id": "6da3b9f0-1a1e-4ff1-94d6-e45c6d1ee9c0",+ "name": "Weekly plan aggregate"+ },+ {+ "parameters": {+ "text": "=Create a monthly plan for this artificial person, who's sharing her life on Instagram using the instructions below.\nUse the {{ $now.format('yyyy') }}-{{ $('Configure workflow').item.json.CURRENT_QUARTER }} plan and the current month to create the right plan.\nEach week of the month should be planned out.\n\n<PersonalProfile>\n{{ $('Configure workflow').item.json.PROFILE }}\n</PersonalProfile>\n\n<Instructions>\n{{ $json.data.Instructions }}\n</Instructions>{{ $json.data.Instructions }}\n\n<QuarterlyPlan>\n{{ $now.format('yyyy') }}-{{ $('Configure workflow').item.json.CURRENT_QUARTER }}:\n\n{{ $('Quaterly plan aggregate').item.json.data[0].plan_value }}\n</QuarterlyPlan>\n\n<CurrentMonth>\n{{ $now.format('MMMM') }}\n</CurrentMonth>\n\n{{ $json.change_requests ? `\nThe monthly plan was already generated, please make the requested changes.\n\n<MonthlyPlan>\n${$json.monthly_plan}\n</MonthlyPlan>\n\n<ChangeRequests>\n${$json.change_requests}\n</ChangeRequests>\n` : '' }}",+ "attributes": {+ "attributes": [+ {+ "name": "monthly_plan",+ "description": "the generated monthly plan",+ "required": true+ }+ ]+ },+ "options": {+ "systemPromptTemplate": "You are a travel planner for a famous instagram celebrity. Create a detailed plan according to the instructions."+ }+ },+ "type": "@n8n/n8n-nodes-langchain.informationExtractor",+ "typeVersion": 1,+ "position": [+ 1160,+ 1420+ ],+ "id": "a2f41bdc-dc5a-4cd7-9924-c13e2c865e16",+ "name": "Generate monthly plan"+ },+ {+ "parameters": {+ "text": "=Create a social media post calendar for this artificial person, who's sharing the life events on Instagram using the instructions below.\nUse the {{ $now.format('yyyy') }}-{{ $('Configure workflow').item.json.CURRENT_QUARTER }} plan, then monthly plan and the target week to create the right plan.\nEach day of the week should be carefully planned, monday to sunday. Add at least one paragraph to each day.\n\n<PersonalProfile>\n{{ $('Configure workflow').item.json.PROFILE }}\n</PersonalProfile>\n\n<Instructions>\n{{ $json.data.Instructions }}\n</Instructions>{{ $json.data.Instructions }}\n\n<QuarterlyPlan>\n{{ $now.format('yyyy') }}-{{ $('Configure workflow').item.json.CURRENT_QUARTER }}:\n\n{{ $('Quaterly plan aggregate').item.json.data[0].plan_value }}\n</QuarterlyPlan>\n\n<MonthlyPlan>\n{{ $('Monthly plan aggregate').item.json.data[0].plan_value }}\n</MonthlyPlan>\n\n<TargetWeek>\n{{ $('Configure workflow').item.json.WEEK }}\n</TargetWeek>\n\n{{ $json.change_requests ? `\nThe weekly plan was already generated, please make the requested changes.\n\n<WeeklyPlan>\n${$json.weekly_plan}\n</WeeklyPlan>\n\n<ChangeRequests>\n${$json.change_requests}\n</ChangeRequests>\n` : '' }}",+ "attributes": {+ "attributes": [+ {+ "name": "weekly_plan",+ "description": "the weekly plan",+ "required": true+ }+ ]+ },+ "options": {+ "systemPromptTemplate": "You are a travel planner for a famous instagram celebrity. Create a detailed plan according to the instructions."+ }+ },+ "type": "@n8n/n8n-nodes-langchain.informationExtractor",+ "typeVersion": 1,+ "position": [+ 1140,+ 2080+ ],+ "id": "b9c51156-8513-431b-9ed9-902c96cc0c03",+ "name": "Generate weekly plan"+ },+ {+ "parameters": {+ "model": {+ "__rl": true,+ "value": "gpt-4.1",+ "mode": "list",+ "cachedResultName": "gpt-4.1"+ },+ "options": {}+ },+ "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",+ "typeVersion": 1.2,+ "position": [+ -100,+ 1600+ ],+ "id": "97beced4-9a89-4633-8555-228159ee95b9",+ "name": "OpenAI Chat Model",+ "credentials": {+ "openAiApi": {+ "id": "tGvJRP2th9CbI2oq",+ "name": "OpenAi account 2"+ }+ }+ },+ {+ "parameters": {+ "content": "# [Watch the video on Youtube](https://youtu.be/x7kEfmQrHqo)",+ "height": 180,+ "width": 580+ },+ "type": "n8n-nodes-base.stickyNote",+ "typeVersion": 1,+ "position": [+ 960,+ 360+ ],+ "id": "e2b84a18-a740-4535-b2f2-d3cf9a755956",+ "name": "Sticky Note7"+ },+ {+ "parameters": {+ "content": "# Need help?\n\n## [Join our Discord server](https://discord.gg/G7FJVJQ6RE)",+ "height": 180,+ "width": 540+ },+ "type": "n8n-nodes-base.stickyNote",+ "typeVersion": 1,+ "position": [+ 1580,+ 360+ ],+ "id": "aa73f125-7d57-4a61-a0af-743dc8cfcc90",+ "name": "Sticky Note8"+ },+ {+ "parameters": {+ "content": "# Read the guides on GitHub\n\n## [Guide to setup Supabase](https://github.com/gyoridavid/ai_agents_az/blob/main/episode_8/guide-supabase.md)\n## [Guide to setup Facebook (Instagram)](https://github.com/gyoridavid/ai_agents_az/blob/main/episode_8/guide-instagram.md)",+ "height": 180,+ "width": 660+ },+ "type": "n8n-nodes-base.stickyNote",+ "typeVersion": 1,+ "position": [+ 260,+ 360+ ],+ "id": "df751b80-eb5c-472c-b2c6-dadb019da0b4",+ "name": "Sticky Note9"+ }+ ],+ "pinData": {},+ "connections": {+ "When clicking ‘Test workflow’": {+ "main": [+ [+ {+ "node": "Configure workflow",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Configure workflow": {+ "main": [+ [+ {+ "node": "Get quarterly plan",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Change request fields": {+ "main": [+ [+ {+ "node": "Generate quarterly plan",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Change request fields1": {+ "main": [+ [+ {+ "node": "Generate monthly plan",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Need changes?1": {+ "main": [+ [+ {+ "node": "Save monthly plan",+ "type": "main",+ "index": 0+ }+ ],+ [+ {+ "node": "Change request fields1",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Get monthly plan": {+ "main": [+ [+ {+ "node": "Monthly plan aggregate",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Has monthly plan?": {+ "main": [+ [+ {+ "node": "Get weekly plan",+ "type": "main",+ "index": 0+ }+ ],+ [+ {+ "node": "Get instructions on the monthly plan",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Get instructions on the monthly plan": {+ "main": [+ [+ {+ "node": "Generate monthly plan",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Montly plan approval": {+ "main": [+ [+ {+ "node": "Need changes?1",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Save monthly plan": {+ "main": [+ [+ {+ "node": "Get monthly plan",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Get weekly plan": {+ "main": [+ [+ {+ "node": "Weekly plan aggregate",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Has weekly plan?": {+ "main": [+ [+ {+ "node": "Get posts from the past 7 days",+ "type": "main",+ "index": 0+ }+ ],+ [+ {+ "node": "Get instructions on the weekly plan",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Get instructions on the weekly plan": {+ "main": [+ [+ {+ "node": "Generate weekly plan",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Weekly plan approval": {+ "main": [+ [+ {+ "node": "Changes to the weekly plan?",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Changes to the weekly plan?": {+ "main": [+ [+ {+ "node": "Save weekly plan",+ "type": "main",+ "index": 0+ }+ ],+ [+ {+ "node": "Weekly plan change fields",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Weekly plan change fields": {+ "main": [+ [+ {+ "node": "Generate weekly plan",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Save weekly plan": {+ "main": [+ [+ {+ "node": "Get weekly plan",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "merge previous week's posts": {+ "main": [+ [+ {+ "node": "Generate new Instagram post",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Generate image with OpenAI": {+ "main": [+ [+ {+ "node": "Convert response to image",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Convert response to image": {+ "main": [+ [+ {+ "node": "Upload image to Supabase",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Add share link": {+ "main": [+ [+ {+ "node": "Get approval for the post",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Get approval for the post": {+ "main": [+ [+ {+ "node": "Post approved?",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Post approved?": {+ "main": [+ [+ {+ "node": "Save the post",+ "type": "main",+ "index": 0+ }+ ],+ [+ {+ "node": "Add post change request fields",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Add post change request fields": {+ "main": [+ [+ {+ "node": "Generate new Instagram post",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Generate unique id": {+ "main": [+ [+ {+ "node": "Download the reference image",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Upload image to Supabase": {+ "main": [+ [+ {+ "node": "Add share link",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Facebook Graph API": {+ "main": [+ [+ {+ "node": "Facebook Graph API1",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Get instructions on the quarterly plan": {+ "main": [+ [+ {+ "node": "Generate quarterly plan",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Has quarterly plan?": {+ "main": [+ [+ {+ "node": "Get monthly plan",+ "type": "main",+ "index": 0+ }+ ],+ [+ {+ "node": "Get instructions on the quarterly plan",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Get quarterly plan": {+ "main": [+ [+ {+ "node": "Quaterly plan aggregate",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Get approval on the quarterly plan": {+ "main": [+ [+ {+ "node": "Approve quarterly plan?",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Save quarterly plan": {+ "main": [+ [+ {+ "node": "Get quarterly plan",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Download the reference image": {+ "main": [+ [+ {+ "node": "Generate image with OpenAI",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Get posts from the past 7 days": {+ "main": [+ [+ {+ "node": "merge previous week's posts",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Save the post": {+ "main": [+ [+ {+ "node": "Facebook Graph API",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Approve quarterly plan?": {+ "main": [+ [+ {+ "node": "Save quarterly plan",+ "type": "main",+ "index": 0+ }+ ],+ [+ {+ "node": "Change request fields",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Generate new Instagram post": {+ "main": [+ [+ {+ "node": "Generate unique id",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Generate quarterly plan": {+ "main": [+ [+ {+ "node": "Get approval on the quarterly plan",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Quaterly plan aggregate": {+ "main": [+ [+ {+ "node": "Has quarterly plan?",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Monthly plan aggregate": {+ "main": [+ [+ {+ "node": "Has monthly plan?",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Weekly plan aggregate": {+ "main": [+ [+ {+ "node": "Has weekly plan?",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Generate monthly plan": {+ "main": [+ [+ {+ "node": "Montly plan approval",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "Generate weekly plan": {+ "main": [+ [+ {+ "node": "Weekly plan approval",+ "type": "main",+ "index": 0+ }+ ]+ ]+ },+ "OpenAI Chat Model": {+ "ai_languageModel": [+ [+ {+ "node": "Generate quarterly plan",+ "type": "ai_languageModel",+ "index": 0+ },+ {+ "node": "Generate monthly plan",+ "type": "ai_languageModel",+ "index": 0+ },+ {+ "node": "Generate weekly plan",+ "type": "ai_languageModel",+ "index": 0+ },+ {+ "node": "Generate new Instagram post",+ "type": "ai_languageModel",+ "index": 0+ }+ ]+ ]+ }+ },+ "active": false,+ "settings": {+ "executionOrder": "v1"+ },+ "versionId": "a62dbdfb-2d05-4ff4-bc6b-3c5563ec1440",+ "meta": {+ "templateCredsSetupCompleted": true,+ "instanceId": "636db6b6ab21a21c6458e2137f340e33dc3e49f5a1c560c8d1e2372c227cf40e"+ },+ "id": "sVeJBX8POs1uesty",+ "tags": []+}\ No newline at end of filediff --git a/episode_8/reference_image.png b/episode_8/reference_image.pngnew file mode 100644index 0000000..f47bb8eBinary files /dev/null and b/episode_8/reference_image.png differ