{
  "id": "-sgWRegC0aCTyUl5ZofeZ",
  "name": "Create an auto-journal from WhatsApp with AI transcription",
  "tags": [],
  "nodes": [
    {
      "id": "a759a56e-74ee-4bce-bd62-55e0004bf1cf",
      "name": "Main Instructions",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1488,
        384
      ],
      "parameters": {
        "width": 600,
        "height": 832,
        "content": "# WhatsApp Auto-Journal with AI Transcription\n\nAutomatically save your WhatsApp messages, voice notes, and images to a Google Doc with AI-powered transcription.\n\n## How it works\n\n1. Send text, audio, or image messages via WhatsApp\n2. Security filter validates authorized phone numbers\n3. Message router identifies content type\n4. Content is processed:\n   - **Text**: Saved directly to Google Doc\n   - **Audio**: Transcribed by Google Gemini AI, uploaded to Drive, transcription saved to Doc\n   - **Images**: Uploaded to Drive, link saved to Doc\n5. Confirmation sent back via WhatsApp\n\n## Setup steps\n\n1. Configure WhatsApp Business API credentials\n2. Set up Google Service Account credentials\n3. Replace `YOURNUMBERPHONE(1/2/3)` in the security filter with authorized phone numbers (international format, no + sign)\n4. Replace `YOUR_GOOGLE_DOC_URL` in all Google Docs nodes\n5. Replace `YOUR_AUDIO_FOLDER_ID` and `YOUR_IMAGE_FOLDER_ID` in Google Drive nodes\n6. Replace `YOUR_WHATSAPP_PHONE_NUMBER_ID` in all confirmation nodes\n7. Configure Google Gemini API credentials for audio transcription\n\n**Test by sending a message to your WhatsApp Business number!**"
      },
      "typeVersion": 1
    },
    {
      "id": "6b2b1215-1728-4ba6-9556-ac0585588088",
      "name": "Security Group",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        480
      ],
      "parameters": {
        "color": 7,
        "width": 380,
        "height": 308,
        "content": "## Security Filter\n\nValidates incoming messages against authorized phone numbers only."
      },
      "typeVersion": 1
    },
    {
      "id": "f0be15f1-1830-47c6-9382-fcedc92e2d6c",
      "name": "Trigger Group",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        592
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 280,
        "content": "## WhatsApp Input\n\nReceives all incoming WhatsApp messages."
      },
      "typeVersion": 1
    },
    {
      "id": "bb83d686-6436-4883-b4e5-9a4448e8ffe9",
      "name": "Router Group",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        352
      ],
      "parameters": {
        "color": 7,
        "width": 340,
        "height": 372,
        "content": "## Message Type Router\n\nRoutes messages based on content type (text, audio, or image)."
      },
      "typeVersion": 1
    },
    {
      "id": "d8415e1d-c955-4c53-a336-1e4f36035573",
      "name": "Text Processing Group",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        128
      ],
      "parameters": {
        "color": 7,
        "width": 564,
        "height": 308,
        "content": "## Text Flow\n\nProcesses text messages and saves them to Google Doc."
      },
      "typeVersion": 1
    },
    {
      "id": "fc55cae5-9066-4003-b092-b08f5e46326c",
      "name": "Audio Processing Group",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        576
      ],
      "parameters": {
        "color": 7,
        "width": 1596,
        "height": 360,
        "content": "## Audio Flow\n\nDownloads audio, transcribes with AI, uploads to Drive, and saves transcription to Doc."
      },
      "typeVersion": 1
    },
    {
      "id": "b878783b-9622-465d-867c-8118c489792c",
      "name": "Image Processing Group",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        1024
      ],
      "parameters": {
        "color": 7,
        "width": 1204,
        "height": 344,
        "content": "## Image Flow\n\nDownloads image, uploads to Drive, and saves link to Doc."
      },
      "typeVersion": 1
    },
    {
      "id": "824e6cbf-3e25-426c-8ecc-331885a7558f",
      "name": "Authorized Numbers Check",
      "type": "n8n-nodes-base.if",
      "position": [
        -352,
        608
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "f36301ec-2d5c-442d-9310-ee9b82bdff1d",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.contacts[0].wa_id }}",
              "rightValue": "YOURNUMBERPHONE(1)"
            },
            {
              "id": "32326d0c-d6ee-4ca7-bb52-4bde0f6cd147",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.contacts[0].wa_id }}",
              "rightValue": "YOURNUMBERPHONE(2)"
            },
            {
              "id": "bef0eebd-02e3-457a-a733-03922bd39f38",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.contacts[0].wa_id }}",
              "rightValue": "YOURNUMBERPHONE(3)"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3a18e046-0bd0-4595-925b-c7f3da3df6ac",
      "name": "Route by Message Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        80,
        512
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Text",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "b15af7b5-d99e-45a6-add5-8d2189d5a189",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.messages[0].type }}",
                    "rightValue": "text"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Audio",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "354f5e2f-a27a-4f3a-96b4-a6d5aed03c8b",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.messages[0].type }}",
                    "rightValue": "audio"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Image",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "3d6a884c-9f6d-4e57-a45f-d5f4ee1b31ba",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.messages[0].type }}",
                    "rightValue": "image"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3
    },
    {
      "id": "2f024bdc-46af-4b8a-97a4-23d73607bf18",
      "name": "Get Audio URL",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        496,
        704
      ],
      "parameters": {
        "resource": "media",
        "operation": "mediaUrlGet",
        "mediaGetId": "={{ $json.messages[0].audio.id }}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "699c8e6a-34e0-4f6a-8b1f-779bb7573f4e",
      "name": "Download Audio File",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        672,
        704
      ],
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {},
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "whatsAppApi"
      },
      "typeVersion": 4.2
    },
    {
      "id": "cb0b7ac4-6e7c-4b83-8e61-b9aa0d36b256",
      "name": "Get Image URL",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        432,
        1184
      ],
      "parameters": {
        "resource": "media",
        "operation": "mediaUrlGet",
        "mediaGetId": "={{ $json.messages[0].image.id }}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "f48c3129-bd5e-4f7f-a217-14b5e2f225c9",
      "name": "Download Image File",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        656,
        1184
      ],
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {},
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "whatsAppApi"
      },
      "typeVersion": 4.2
    },
    {
      "id": "8300b7b7-ca7e-4dc0-beb2-9f30d06e4c06",
      "name": "Save Text to Google Doc",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        528,
        272
      ],
      "parameters": {
        "actionsUi": {
          "actionFields": [
            {
              "text": "=\n[{{ $now.format('DD HH:mm:ss') }} {{ $('WhatsApp Trigger').item.json.contacts[0].profile.name }}]\n\n--- Text Message ----\n\n{{ $('WhatsApp Trigger').item.json.messages[0].text.body }}\n\n------",
              "action": "insert"
            }
          ]
        },
        "operation": "update",
        "documentURL": "YOUR_GOOGLE_DOC_URL",
        "authentication": "serviceAccount"
      },
      "typeVersion": 2
    },
    {
      "id": "6b399003-bd56-461f-9360-a9ae5809f46e",
      "name": "Save Audio Transcription to Google Doc",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        1568,
        704
      ],
      "parameters": {
        "actionsUi": {
          "actionFields": [
            {
              "text": "=\n[{{ $now.format('DD HH:mm:ss') }} {{ $('WhatsApp Trigger').item.json.contacts[0].profile.name }}]\n\n--- Audio Message ----\n\n{{ $json.webViewLink }}\n\n--- Audio Content ----\n\n{{ $('Transcribe Audio with AI').item.json.candidates[0].content.parts[0].text }}\n\n------",
              "action": "insert"
            }
          ]
        },
        "operation": "update",
        "documentURL": "YOUR_GOOGLE_DOC_URL",
        "authentication": "serviceAccount"
      },
      "typeVersion": 2
    },
    {
      "id": "89168bb7-3e74-45cf-bbb3-fd003dafd120",
      "name": "Upload Audio to Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1344,
        704
      ],
      "parameters": {
        "name": "={{ $now.format('DD HH:mm:ss') }}.ogg",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_AUDIO_FOLDER_ID",
          "cachedResultUrl": "https://drive.google.com/drive/folders/YOUR_AUDIO_FOLDER_ID",
          "cachedResultName": "Audio"
        },
        "inputDataFieldName": "=data"
      },
      "typeVersion": 3
    },
    {
      "id": "d54daba6-dead-4101-af39-7939261c8e7e",
      "name": "Transcribe Audio with AI",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        896,
        704
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-flash",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "options": {},
        "resource": "audio",
        "simplify": false,
        "inputType": "binary"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "7cdf2e52-2457-413f-a0dd-49a340e0cd01",
      "name": "Upload Image to Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        880,
        1184
      ],
      "parameters": {
        "name": "={{ $now.format('DD HH:mm:ss') }}.jpg",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_IMAGE_FOLDER_ID",
          "cachedResultUrl": "https://drive.google.com/drive/folders/YOUR_IMAGE_FOLDER_ID",
          "cachedResultName": "Images"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "eb247069-5d4a-4b94-a30f-3328af4992a7",
      "name": "Send Text Confirmation",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        800,
        272
      ],
      "parameters": {
        "textBody": "\ud83d\ude09 Document updated!",
        "operation": "send",
        "phoneNumberId": "YOUR_WHATSAPP_PHONE_NUMBER_ID",
        "additionalFields": {},
        "recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.contacts[0].wa_id }}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "9c985a79-8a9d-4bff-bbb0-9e83ba50a3bf",
      "name": "Send Audio Confirmation",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        1792,
        704
      ],
      "parameters": {
        "textBody": "\ud83d\ude0a Document updated and audio uploaded!",
        "operation": "send",
        "phoneNumberId": "YOUR_WHATSAPP_PHONE_NUMBER_ID",
        "additionalFields": {},
        "recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.contacts[0].wa_id }}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "1f8bb4c6-9e57-4345-ad53-7f4ed8c50966",
      "name": "Send Image Confirmation",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        1328,
        1184
      ],
      "parameters": {
        "textBody": "\ud83d\ude03 Document updated and image uploaded!",
        "operation": "send",
        "phoneNumberId": "YOUR_WHATSAPP_PHONE_NUMBER_ID",
        "additionalFields": {},
        "recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.contacts[0].wa_id }}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "eb1c44f7-4bff-49f1-a922-0037c678a684",
      "name": "Convert Audio to Binary",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1120,
        704
      ],
      "parameters": {
        "url": "={{ $('Get Audio URL').item.json.url }}",
        "options": {},
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "whatsAppApi"
      },
      "typeVersion": 4.2
    },
    {
      "id": "c8d41901-ec09-4dca-907c-c2a8db2de40d",
      "name": "Save Image Link to Google Doc",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        1104,
        1184
      ],
      "parameters": {
        "actionsUi": {
          "actionFields": [
            {
              "text": "=\n[{{ $now.format('DD HH:mm:ss') }} {{ $('WhatsApp Trigger').item.json.contacts[0].profile.name }}]\n\n--- Image Uploaded ----\n\n{{ $json.webViewLink }}\n\n------",
              "action": "insert"
            }
          ]
        },
        "operation": "update",
        "documentURL": "YOUR_GOOGLE_DOC_URL",
        "authentication": "serviceAccount"
      },
      "typeVersion": 2
    },
    {
      "id": "6ec519c7-21a6-4dd5-9624-f5e1c15aa479",
      "name": "WhatsApp Trigger",
      "type": "n8n-nodes-base.whatsAppTrigger",
      "position": [
        -592,
        704
      ],
      "parameters": {
        "options": {},
        "updates": [
          "messages"
        ]
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "6e96a532-ceca-4174-94f4-dc7cfd1fd63b",
  "connections": {
    "Get Audio URL": {
      "main": [
        [
          {
            "node": "Download Audio File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Image URL": {
      "main": [
        [
          {
            "node": "Download Image File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WhatsApp Trigger": {
      "main": [
        [
          {
            "node": "Authorized Numbers Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Audio File": {
      "main": [
        [
          {
            "node": "Transcribe Audio with AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Image File": {
      "main": [
        [
          {
            "node": "Upload Image to Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Message Type": {
      "main": [
        [
          {
            "node": "Save Text to Google Doc",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Audio URL",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Image URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Audio to Drive": {
      "main": [
        [
          {
            "node": "Save Audio Transcription to Google Doc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Image to Drive": {
      "main": [
        [
          {
            "node": "Save Image Link to Google Doc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert Audio to Binary": {
      "main": [
        [
          {
            "node": "Upload Audio to Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Text to Google Doc": {
      "main": [
        [
          {
            "node": "Send Text Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Authorized Numbers Check": {
      "main": [
        [
          {
            "node": "Route by Message Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe Audio with AI": {
      "main": [
        [
          {
            "node": "Convert Audio to Binary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Image Link to Google Doc": {
      "main": [
        [
          {
            "node": "Send Image Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Audio Transcription to Google Doc": {
      "main": [
        [
          {
            "node": "Send Audio Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}