{
  "name": "Issue Rivhit receipts from WhatsApp photos using Google Vision and GPT-4o",
  "nodes": [
    {
      "id": "74c4a220-ac0d-4b39-8d76-b3af3fca983f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -768,
        -144
      ],
      "parameters": {
        "width": 420,
        "height": 620,
        "content": "## WhatsApp AI Receipt Agent\n**Automatically issue receipts from invoice & payment photos**\n\n### Who is it for\nSmall businesses using Rivhit accounting + WhatsApp for field payment collection.\n\n### Ho"
      }
    },
    {
      "id": "baffd3fe-4025-4478-bb38-267948a96e64",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        192
      ],
      "parameters": {
        "width": 520,
        "height": 280,
        "content": "### 1. Webhook & Filtering\nReceives incoming WhatsApp messages via WAHA and filters to only process messages from the designated bot group."
      }
    },
    {
      "id": "fb257df8-fdd3-4684-a77c-ba16b28ca5f6",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        128
      ],
      "parameters": {
        "width": 560,
        "height": 280,
        "content": "### 2. OCR & Message Preparation\nIf the message contains an image → extract text using Google Vision OCR.\nThe extracted text is then appended to the courier's message so the AI Agent can read it."
      }
    },
    {
      "id": "143cd48b-5a08-4b83-864f-9b22781f3e0d",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        80
      ],
      "parameters": {
        "width": 620,
        "height": 320,
        "content": "### 3. AI Agent + Rivhit API Tool\nThe AI Agent reads conversation history, extracts invoice/payment details, and calls the Rivhit API tool to:\n- Issue receipts (cash, check, credit, transfer, multiple"
      }
    },
    {
      "id": "454ca326-846b-4e81-8ebc-5e1e3ef85658",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1760,
        80
      ],
      "parameters": {
        "width": 520,
        "height": 280,
        "content": "### 4. Response Delivery\nIf a document (PDF) was generated → send it as a file attachment with a caption.\nOtherwise → send a text-only reply."
      }
    },
    {
      "id": "2208a531-5d3d-4a71-9912-efbf33102811",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1296,
        -48
      ],
      "parameters": {
        "width": 300,
        "height": 120,
        "content": "⚠️ **Add your Rivhit API token here**\nGet it from your Rivhit account settings → API section."
      }
    },
    {
      "id": "5999ca01-3f84-417b-8082-e932e50b633c",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        480
      ],
      "parameters": {
        "width": 320,
        "height": 130,
        "content": "⚠️ **Replace with your WhatsApp group ID**\nFormat: `120363XXXXXXXXXX@g.us`\nYou can find it in the webhook payload under `payload.from`."
      }
    },
    {
      "id": "cd821b62-0e6b-4cfd-85f6-39e4cebcca9f",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        592,
        0
      ],
      "parameters": {
        "width": 320,
        "height": 120,
        "content": "⚠️ **Add your Google Cloud Vision API key**\nEnable the Vision API in your Google Cloud Console and paste the key in the query parameter below."
      }
    },
    {
      "id": "6adfcfac-aa2b-484b-8b06-90831c59f297",
      "name": "Is there a picture or not?",
      "type": "n8n-nodes-base.if",
      "position": [
        400,
        304
      ]
    },
    {
      "id": "7f718c14-a8c7-42a5-b1e7-191bae1c7890",
      "name": "Preparing a message",
      "type": "n8n-nodes-base.code",
      "position": [
        848,
        304
      ]
    },
    {
      "id": "78348c53-84fb-4c8d-8691-07fbb768b2f0",
      "name": "Extracting text from images",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        624,
        208
      ]
    },
    {
      "id": "ae295294-5be0-426b-b91e-8da94903cb2b",
      "name": "api key",
      "type": "n8n-nodes-base.set",
      "position": [
        1072,
        304
      ]
    },
    {
      "id": "982f57fc-2d3b-4afe-ad8f-262489dff9da",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1360,
        304
      ]
    },
    {
      "id": "dd4267cf-848b-4aac-bf57-91a729cca290",
      "name": "rivhit_api",
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "position": [
        1552,
        528
      ]
    },
    {
      "id": "28c6f496-39be-488a-98bf-97185298721d",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1424,
        528
      ]
    },
    {
      "id": "a1297d66-e563-496b-b3e7-d611582f3a8e",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1296,
        528
      ]
    },
    {
      "id": "a913ad9e-69a0-4453-9c5a-61042c9e0a4a",
      "name": "Separation between the message and document link",
      "type": "n8n-nodes-base.code",
      "position": [
        1760,
        304
      ]
    },
    {
      "id": "51b97d72-221c-4fe3-8867-bb38cf10af45",
      "name": "Only if there is an attachment",
      "type": "n8n-nodes-base.if",
      "position": [
        1984,
        304
      ]
    },
    {
      "id": "a7053452-9227-4724-9879-089c67109f6f",
      "name": "Send a file",
      "type": "@devlikeapro/n8n-nodes-waha.WAHA",
      "position": [
        2208,
        192
      ]
    },
    {
      "id": "0eb297e6-28a3-41b6-af9b-539590195940",
      "name": "Send a text message",
      "type": "n8n-nodes-waha.WAHA",
      "position": [
        2208,
        400
      ]
    },
    {
      "id": "fe6f8f46-95c6-4f7a-9f17-0690f0c0036d",
      "name": "Start Typing",
      "type": "@devlikeapro/n8n-nodes-waha.WAHA",
      "position": [
        176,
        304
      ]
    },
    {
      "id": "d71dd8e5-ea76-467b-a389-1846caed4716",
      "name": "Only if it's from the bot's group",
      "type": "n8n-nodes-base.filter",
      "position": [
        -48,
        304
      ]
    },
    {
      "id": "35dfe9c1-d8bd-4750-8803-c82070b0a5cd",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -272,
        304
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Only if it's from the bot's group",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "api key": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Separation between the message and document link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "rivhit_api": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Start Typing": {
      "main": [
        [
          {
            "node": "Is there a picture or not?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Preparing a message": {
      "main": [
        [
          {
            "node": "api key",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is there a picture or not?": {
      "main": [
        [
          {
            "node": "Extracting text from images",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Preparing a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extracting text from images": {
      "main": [
        [
          {
            "node": "Preparing a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Only if there is an attachment": {
      "main": [
        [
          {
            "node": "Send a file",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Only if it's from the bot's group": {
      "main": [
        [
          {
            "node": "Start Typing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Separation between the message and document link": {
      "main": [
        [
          {
            "node": "Only if there is an attachment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}