PostgresとGallaboxを使って、個別メッセージを自動送信するWhatsAppリードのダイジェストマーケティング

中級

これはLead Nurturing, Multimodal AI分野の自動化ワークフローで、11個のノードを含みます。主にCode, Postgres, HttpRequest, SplitInBatches, ScheduleTriggerなどのノードを使用。 PostgresとGallaboxを使った自動化されたWhatsAppリード個別メッセージング

前提条件
  • PostgreSQLデータベース接続情報
  • ターゲットAPIの認証情報が必要な場合あり
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "meta": {
    "instanceId": "807c58b937f3c75f8b242bc4ac5f455a51832cabd7bcdbecd9fdc3ba6179a8c9",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "84e5aa63-1375-4aa5-980a-b8d252d7535b",
      "name": "SQL クエリを実行",
      "type": "n8n-nodes-base.postgres",
      "onError": "continueRegularOutput",
      "position": [
        4040,
        520
      ],
      "parameters": {
        "query": "SELECT * FROM \"MQL\".mql_contacts\nWHERE (\n  (count = 0)\n   OR \n  (count = 1 AND (NOW() AT TIME ZONE 'Asia/Kolkata') - webhook_time > INTERVAL '3 minutes')\n   OR \n  (count = 2 AND (NOW() AT TIME ZONE 'Asia/Kolkata') - webhook_time > INTERVAL '5 minutes')\n   OR \n  (count = 3 AND (NOW() AT TIME ZONE 'Asia/Kolkata') - webhook_time > INTERVAL '8 minutes')\n)\n  AND\n  disposition = 'unqualified'\n  ;",
        "options": {},
        "operation": "executeQuery"
      },
      "retryOnFail": true,
      "typeVersion": 2.6,
      "alwaysOutputData": true
    },
    {
      "id": "4c385ae2-6ffe-4f84-8647-cc347dd32ad4",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4000,
        680
      ],
      "parameters": {
        "width": 176,
        "height": 80,
        "content": "Gets unqualified leads which count 0,1,2,3 respective time"
      },
      "typeVersion": 1
    },
    {
      "id": "fcdf84ff-57e4-4faa-adcb-c0e3d707e34c",
      "name": "スケジュールトリガー",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        3720,
        520
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "seconds"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "00e9e762-8a4a-46be-85e8-e3bbd86bfc07",
      "name": "コード1",
      "type": "n8n-nodes-base.code",
      "position": [
        4780,
        540
      ],
      "parameters": {
        "jsCode": "// Define matrix with count mapping\nconst matrix = {\n  nexus: {\n    0: \"🛵 sample1\",\n    1: \"⚡️ sample1\",\n    2: \"🔋 sample1\",\n    3: \"✨ sample1\"\n  },\n  magnus: {\n    0: \"🛵 sample2\",\n    1: \"⚡️ sample2\",\n    2: \"🔋 sample2\",\n    3: \"✨ sample2\"\n  },\n  reo: {\n    0: \"🛵 sample3\",\n    1: \"⚡️ sample3\",\n    2: \"🔋 sample3\",\n    3: \"✨sample3\"\n  },\n  general: {\n    0: \"🛵 sample4\",\n    1: \"⚡️sample4\",\n    2: \"🔋 sample4\",\n    3: \"✨ sample3\"\n  }\n};\n\n// Get inputs from previous node\nconst model = $input.first().json.model// \"nexus\" / \"reo\" / \"magnus\" / \"general\"\nconst count =  $input.first().json.count // 0 / 1 / 2 / 3\n\n// const model = \"general\"; \n// const count = 0; \n\n// Fetch matching content\nconst output = matrix[model]?.[count] || \"🛵 default\";\n\n// Return as output\nreturn [{ json: { model, count, output } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "8c5fad3d-46b3-427e-ab5a-205712394bd0",
      "name": "アイテムをループ処理4",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        4520,
        520
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "a7846d82-40fa-4f73-b22a-a100009d276c",
      "name": "新規リード_4",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        5000,
        540
      ],
      "parameters": {
        "url": "https://server.gallabox.com/devapi/messages/whatsapp",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        },
        "jsonBody": "=add here your copy api for whatsapp sending\n{\n    \"channelId\": \"0\",\n    \"channelType\": \"whatsapp\",\n    \"recipient\": {\n        \"name\": \"{{ $('Execute a SQL query').item.json.name }}\",\n        \"phone\": \"91{{ $('Execute a SQL query').item.json.phone }}\"\n    },\n    \"whatsapp\": {\n        \"type\": \"template\",\n        \"template\": {\n            \"templateName\": \"waba_qual_21july25\",\n            \"bodyValues\": {\n                \"Name\": \"{{ $('Execute a SQL query').item.json.name }}\",\n                \"Details\": \"{{ $json.output }}\"\n            },\n            \"buttonValues\": [\n                {\n                    \"index\": 0,\n                    \"sub_type\": \"quick_reply\",\n                    \"parameters\": {\n                        \"type\": \"payload\",\n                        \"payload\": \"Show Brochure\"\n                    }\n                },\n                {\n                    \"index\": 1,\n                    \"sub_type\": \"quick_reply\",\n                    \"parameters\": {\n                        \"type\": \"payload\",\n                        \"payload\": \"Get Showroom Location\"\n                    }\n                },\n                {\n                    \"index\": 2,\n                    \"sub_type\": \"quick_reply\",\n                    \"parameters\": {\n                        \"type\": \"payload\",\n                        \"payload\": \"Not Interested\"\n                    }\n                }\n            ]\n        }\n    }\n}",
        "sendBody": true,
        "jsonHeaders": "{\n  \"apiKey\": \"\",\n  \"apiSecret\": \"\"\n}",
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "specifyHeaders": "json",
        "genericAuthType": "httpCustomAuth"
      },
      "typeVersion": 4.1
    },
    {
      "id": "505800b6-fbe6-49bd-bd97-5cfb3a34da8c",
      "name": "テーブルの行を更新4",
      "type": "n8n-nodes-base.postgres",
      "position": [
        5500,
        540
      ],
      "parameters": {
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "mql_contacts",
          "cachedResultName": "mql_contacts"
        },
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "MQL",
          "cachedResultName": "MQL"
        },
        "columns": {
          "value": {
            "count": "={{ $('Execute a SQL query').item.json.count + 1  }}",
            "phone": "={{ $('Execute a SQL query').item.json.phone }}",
            "pincode": 0,
            "last_message_sent": "={{ $json.last_sent }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "created_at",
              "type": "dateTime",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "created_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "updated_at",
              "type": "dateTime",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "updated_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "phone",
              "type": "number",
              "display": true,
              "removed": false,
              "required": true,
              "displayName": "phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "last_message_sent",
              "type": "dateTime",
              "display": true,
              "required": false,
              "displayName": "last_message_sent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "disposition",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "disposition",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "count",
              "type": "number",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "count",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "interval",
              "type": "number",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "interval",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "remarks",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "remarks",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "model",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "model",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pincode",
              "type": "number",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "pincode",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ABOS API status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "ABOS API status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "webhook_time",
              "type": "dateTime",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "webhook_time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "phone"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "typeVersion": 2.6
    },
    {
      "id": "f7729e9d-8f3b-477a-88fe-513be43997e4",
      "name": "テーブルに行を挿入4",
      "type": "n8n-nodes-base.postgres",
      "position": [
        5280,
        540
      ],
      "parameters": {
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "mql_logs",
          "cachedResultName": "mql_logs"
        },
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "MQL",
          "cachedResultName": "MQL"
        },
        "columns": {
          "value": {
            "name": "={{ $('Execute a SQL query').item.json.name }}",
            "phone": "={{ $('Execute a SQL query').item.json.phone }}",
            "remarks": "Workflow 1",
            "last_sent": "={{ $('Execute a SQL query').item.json.last_message_sent }}",
            "mes_count": "={{ $('Execute a SQL query').item.json.count }}",
            "message_id": "={{ $json.body.id }}",
            "disposition": "={{ $('Execute a SQL query').item.json.disposition }}",
            "gb_status_code": "={{ $json.statusCode }}",
            "gb_status_message": "={{ $json.body.status }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "created_at",
              "type": "dateTime",
              "display": true,
              "required": false,
              "displayName": "created_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "updated_at",
              "type": "dateTime",
              "display": true,
              "required": false,
              "displayName": "updated_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "message_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "message_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "phone",
              "type": "number",
              "display": true,
              "required": true,
              "displayName": "phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "disposition",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "disposition",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "mes_count",
              "type": "number",
              "display": true,
              "required": false,
              "displayName": "mes_count",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "last_sent",
              "type": "dateTime",
              "display": true,
              "required": false,
              "displayName": "last_sent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "gb_status_code",
              "type": "number",
              "display": true,
              "required": false,
              "displayName": "gb_status_code",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "gb_status_message",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "gb_status_message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "message_status_meta",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "message_status_meta",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cta",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "cta",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "remarks",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "remarks",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "typeVersion": 2.6
    },
    {
      "id": "a6bb388a-17f3-4e24-94a4-47abf67dacf4",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4640,
        420
      ],
      "parameters": {
        "width": 216,
        "height": 80,
        "content": "Matrixed code to add unque message for pushing that to message with variable\n"
      },
      "typeVersion": 1
    },
    {
      "id": "afd6a70f-80ae-4c3e-8b82-bd784dacfbe5",
      "name": "付箋2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5000,
        420
      ],
      "parameters": {
        "width": 150,
        "height": 80,
        "content": "Gallabox/whatsapp sending api"
      },
      "typeVersion": 1
    },
    {
      "id": "13fe2f75-fe06-423a-9334-a4be0025624d",
      "name": "付箋3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5380,
        420
      ],
      "parameters": {
        "width": 150,
        "height": 80,
        "content": "Postgres connection to store data "
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "00e9e762-8a4a-46be-85e8-e3bbd86bfc07": {
      "main": [
        [
          {
            "node": "a7846d82-40fa-4f73-b22a-a100009d276c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a7846d82-40fa-4f73-b22a-a100009d276c": {
      "main": [
        [
          {
            "node": "f7729e9d-8f3b-477a-88fe-513be43997e4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8c5fad3d-46b3-427e-ab5a-205712394bd0": {
      "main": [
        [],
        [
          {
            "node": "00e9e762-8a4a-46be-85e8-e3bbd86bfc07",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "fcdf84ff-57e4-4faa-adcb-c0e3d707e34c": {
      "main": [
        [
          {
            "node": "84e5aa63-1375-4aa5-980a-b8d252d7535b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "84e5aa63-1375-4aa5-980a-b8d252d7535b": {
      "main": [
        [
          {
            "node": "8c5fad3d-46b3-427e-ab5a-205712394bd0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f7729e9d-8f3b-477a-88fe-513be43997e4": {
      "main": [
        [
          {
            "node": "505800b6-fbe6-49bd-bd97-5cfb3a34da8c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "505800b6-fbe6-49bd-bd97-5cfb3a34da8c": {
      "main": [
        [
          {
            "node": "8c5fad3d-46b3-427e-ab5a-205712394bd0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

中級 - リードナーチャリング, マルチモーダルAI

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

関連ワークフロー

GPT-4駆動のカールドメールワークフロー(完全カスタマイズされた3本のメールフォロー付き)
GPT-4、Mailgun、Supabaseを使ってパーソナライズされたラグディ冷信Seriesを自動化
If
Set
Code
+
If
Set
Code
100 ノードPaul
リードナーチャリング
Airtable、OpenAI、Unipile を使用した LinkedIn リード生成と自動ダイレクトメッセージングの自動化
Airtable、OpenAI、Unipileを使用した自動LinkedInリード生成とInMail投稿
If
Set
Code
+
If
Set
Code
143 ノードRuben AI
リードナーチャリング
Gallabox APIとSupabaseを使ったWhatsAppリードをダイジェストマーケティング
Gallabox APIとSupabaseを使った自動化された週次WhatsAppリード育成
If
Switch
Supabase
+
If
Switch
Supabase
34 ノードRahi
リードナーチャリング
Google テーブルから Rapiwa API を使用して WhatsApp ウェルカムメッセージを自動送信
GoogleテーブルとRapiwaを使用したセールスリード向けWhatsApp歓迎メッセージの自動送信
If
Code
Wait
+
If
Code
Wait
17 ノードSpaGreen Creative
リードナーチャリング
キーワードからGPT-5とfal.ai画像を使ってWordPressまで自動SEOブログ生成のプロセス
GPT-5とfal.ai画像を使用したキーワードからWordPressへのSEOブログ自動化プロセス
Set
Code
Wait
+
Set
Code
Wait
96 ノードPaul
コンテンツ作成
Apollo.io かつ Google スプレッドシートを使用した LinkedIn のリード豊富化パイプラインの自動化
Apollo.ioとGoogleスプレッドシートを使用した自動LinkedInリード豊富化パイプライン
If
Code
Wait
+
If
Code
Wait
33 ノードRahi Uppal
リード獲得
ワークフロー情報
難易度
中級
ノード数11
カテゴリー2
ノードタイプ6
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

作成者

AI and Automation Consultant with over 1000 hours of experience building, deploying, and solving marketing and sales automation problems. I ship AI products faster by combining business acumen with AI & automation expertise and an engineering mindset. Connect with me on LinkedIn to chat.

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34