{
  "meta": {
    "templateCreatedBy": "apipedia",
    "templateId": "apipedia-waconsole-template",
    "instanceId": "waconsole-api-integration"
  },
  "name": "Apipedia WaConsole - All-in-One Messaging API",
  "nodes": [
    {
      "parameters": {},
      "id": "d2abd673-56a9-4470-bfdb-a45b8ce4b1b8",
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "authkey",
              "value": "your_authkey_here"
            },
            {
              "name": "appkey",
              "value": "your_appkey_here"
            },
            {
              "name": "base_url",
              "value": "https://waconsole.apipedia.id"
            },
            {
              "name": "test_phone",
              "value": "628123456789"
            },
            {
              "name": "test_telegram_chat",
              "value": "123456789"
            },
            {
              "name": "agent_id",
              "value": "your-ai-agent-uuid"
            }
          ]
        }
      },
      "id": "7b2c8f5d-4a1e-4d9c-8f1b-2e3f4a5b6c7d",
      "name": "Set API Credentials",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "{{ $json.message_type }}",
              "operation": "equal",
              "value2": "whatsapp_single"
            }
          ]
        }
      },
      "id": "a3b4c5d6-e7f8-4a5b-9c8d-1e2f3a4b5c6d",
      "name": "Check Message Type",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        680,
        300
      ]
    },
    {
      "parameters": {
        "url": "={{ $node['Set API Credentials'].json.base_url }}/api/create-message",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n  \"authkey\": \"{{ $node['Set API Credentials'].json.authkey }}\",\n  \"appkey\": \"{{ $node['Set API Credentials'].json.appkey }}\",\n  \"to\": \"{{ $node['Set API Credentials'].json.test_phone }}\",\n  \"message\": \"{{ $json.message || 'Hello from n8n via Apipedia WaConsole!' }}\"\n}",
        "options": {}
      },
      "id": "b1c2d3e4-f5a6-4b7c-8d9e-0f1a2b3c4d5e",
      "name": "Send WhatsApp Message",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        900,
        180
      ]
    },
    {
      "parameters": {
        "url": "={{ $node['Set API Credentials'].json.base_url }}/api/create-message",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n  \"authkey\": \"{{ $node['Set API Credentials'].json.authkey }}\",\n  \"appkey\": \"{{ $node['Set API Credentials'].json.appkey }}\",\n  \"to\": \"{{ $node['Set API Credentials'].json.test_phone }}\",\n  \"message\": \"{{ $json.message || 'Check out this media!' }}\",\n  \"file\": \"{{ $json.file_url }}\"\n}",
        "options": {}
      },
      "id": "c2d3e4f5-a6b7-4c8d-9e0f-1a2b3c4d5e6f",
      "name": "Send WhatsApp Media",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        900,
        300
      ]
    },
    {
      "parameters": {
        "url": "={{ $node['Set API Credentials'].json.base_url }}/api/bulk-messagev1",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n  \"authkey\": \"{{ $node['Set API Credentials'].json.authkey }}\",\n  \"appkey\": \"{{ $node['Set API Credentials'].json.appkey }}\",\n  \"to\": \"{{ $json.recipients || '628123456789|628987654321' }}\",\n  \"message\": \"{{ $json.message || 'Bulk message from n8n!' }}\"\n}",
        "options": {}
      },
      "id": "d3e4f5a6-b7c8-4d9e-0f1a-2b3c4d5e6f7a",
      "name": "Send Bulk WhatsApp",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        900,
        420
      ]
    },
    {
      "parameters": {
        "url": "={{ $node['Set API Credentials'].json.base_url }}/api/sms/send-reguler",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n  \"authkey\": \"{{ $node['Set API Credentials'].json.authkey }}\",\n  \"appkey\": \"{{ $node['Set API Credentials'].json.appkey }}\",\n  \"to\": \"{{ $node['Set API Credentials'].json.test_phone }}\",\n  \"msg\": \"{{ $json.message || 'SMS from n8n via Apipedia!' }}\"\n}",
        "options": {}
      },
      "id": "e4f5a6b7-c8d9-4e0f-1a2b-3c4d5e6f7a8b",
      "name": "Send SMS",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        900,
        540
      ]
    },
    {
      "parameters": {
        "url": "={{ $node['Set API Credentials'].json.base_url }}/api/telegram/send_message",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n  \"authkey\": \"{{ $node['Set API Credentials'].json.authkey }}\",\n  \"appkey\": \"{{ $node['Set API Credentials'].json.appkey }}\",\n  \"receiver\": \"{{ $node['Set API Credentials'].json.test_telegram_chat }}\",\n  \"body\": \"{{ $json.message || 'Hello from n8n via Telegram!' }}\"\n}",
        "options": {}
      },
      "id": "f5a6b7c8-d9e0-4f1a-2b3c-4d5e6f7a8b9c",
      "name": "Send Telegram Message",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        900,
        660
      ]
    },
    {
      "parameters": {
        "url": "={{ $node['Set API Credentials'].json.base_url }}/api/chat-ai/send-message",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n  \"authkey\": \"{{ $node['Set API Credentials'].json.authkey }}\",\n  \"appkey\": \"{{ $node['Set API Credentials'].json.appkey }}\",\n  \"agent_id\": \"{{ $node['Set API Credentials'].json.agent_id }}\",\n  \"message\": \"{{ $json.message || 'Hello AI! Can you help me?' }}\",\n  \"format\": \"{{ $json.format || 'json' }}\"\n}",
        "options": {}
      },
      "id": "a6b7c8d9-e0f1-4a2b-3c4d-5e6f7a8b9c0d",
      "name": "Send AI Chat",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        900,
        780
      ]
    },
    {
      "parameters": {
        "url": "={{ $node['Set API Credentials'].json.base_url }}/api/presence/update",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n  \"authkey\": \"{{ $node['Set API Credentials'].json.authkey }}\",\n  \"appkey\": \"{{ $node['Set API Credentials'].json.appkey }}\",\n  \"receiver\": \"{{ $node['Set API Credentials'].json.test_phone }}\",\n  \"presence\": \"{{ $json.presence || 'composing' }}\"\n}",
        "options": {}
      },
      "id": "b7c8d9e0-f1a2-4b3c-4d5e-6f7a8b9c0d1e",
      "name": "Set WhatsApp Presence",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        900,
        900
      ]
    },
    {
      "parameters": {
        "url": "={{ $node['Set API Credentials'].json.base_url }}/api/profile/simple?authkey={{ $node['Set API Credentials'].json.authkey }}",
        "options": {}
      },
      "id": "c8d9e0f1-a2b3-4c4d-5e6f-7a8b9c0d1e2f",
      "name": "Get User Profile",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        900,
        1020
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.success }}",
              "operation": "equal",
              "value2": "true"
            }
          ]
        }
      },
      "id": "d9e0f1a2-b3c4-4d5e-6f7a-8b9c0d1e2f3a",
      "name": "Check API Response",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        1120,
        500
      ]
    },
    {
      "parameters": {
        "message": "✅ API call successful! Message sent via {{ $json.channel || 'WaConsole' }}",
        "additionalFields": {
          "title": "WaConsole API Success"
        }
      },
      "id": "e0f1a2b3-c4d5-4e6f-7a8b-9c0d1e2f3a4b",
      "name": "Success Notification",
      "type": "n8n-nodes-base.discord",
      "typeVersion": 1,
      "position": [
        1340,
        400
      ]
    },
    {
      "parameters": {
        "message": "❌ API call failed: {{ $json.message || 'Unknown error' }}",
        "additionalFields": {
          "title": "WaConsole API Error"
        }
      },
      "id": "f1a2b3c4-d5e6-4f7a-8b9c-0d1e2f3a4b5c",
      "name": "Error Notification",
      "type": "n8n-nodes-base.discord",
      "typeVersion": 1,
      "position": [
        1340,
        600
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "webhook_trigger",
              "leftValue": "={{ $json.trigger_type }}",
              "rightValue": "webhook",
              "operator": {
                "type": "string",
                "operation": "equals",
                "rightType": "any"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
      "name": "Webhook Handler",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        460,
        480
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "waconsole-webhook",
        "options": {}
      },
      "id": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        240,
        480
      ],
      "webhookId": "waconsole-incoming-webhook"
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Set API Credentials",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set API Credentials": {
      "main": [
        [
          {
            "node": "Check Message Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Message Type": {
      "main": [
        [
          {
            "node": "Send WhatsApp Message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send WhatsApp Media",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Bulk WhatsApp",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send SMS",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Telegram Message",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send AI Chat",
            "type": "main",
            "index": 0
          },
          {
            "node": "Set WhatsApp Presence",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get User Profile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send WhatsApp Message": {
      "main": [
        [
          {
            "node": "Check API Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send WhatsApp Media": {
      "main": [
        [
          {
            "node": "Check API Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Bulk WhatsApp": {
      "main": [
        [
          {
            "node": "Check API Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send SMS": {
      "main": [
        [
          {
            "node": "Check API Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Telegram Message": {
      "main": [
        [
          {
            "node": "Check API Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send AI Chat": {
      "main": [
        [
          {
            "node": "Check API Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set WhatsApp Presence": {
      "main": [
        [
          {
            "node": "Check API Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get User Profile": {
      "main": [
        [
          {
            "node": "Check API Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check API Response": {
      "main": [
        [
          {
            "node": "Success Notification",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Handler": {
      "main": [
        [
          {
            "node": "Check Message Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Webhook Handler",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [
    {
      "createdAt": "2024-01-01T00:00:00.000Z",
      "updatedAt": "2024-01-01T00:00:00.000Z",
      "id": "apipedia-waconsole",
      "name": "Apipedia WaConsole"
    }
  ],
  "triggerCount": 0,
  "updatedAt": "2024-01-01T00:00:00.000Z",
  "versionId": "1.0.0",
  "description": "Complete n8n workflow template for Apipedia WaConsole All-in-One messaging API integration. Supports WhatsApp, SMS, Telegram, AI Chat, and presence management with error handling and notifications.\n\n## Features:\n- Multi-channel messaging (WhatsApp, SMS, Telegram)\n- AI Chat integration\n- WhatsApp presence management  \n- User profile retrieval\n- Webhook handling for incoming messages\n- Error handling and notifications\n- Bulk messaging support\n- Media file sending\n\n## Setup Instructions:\n1. Import this workflow into n8n\n2. Update the 'Set API Credentials' node with your actual API keys\n3. Configure notification nodes (Discord, Slack, etc.) with your webhook URLs\n4. Test each messaging channel individually\n5. Enable webhook endpoint for incoming message handling\n\n## Usage:\n- Manual execution: Trigger the workflow manually for testing\n- Webhook trigger: Set up webhook endpoint for automated message handling\n- Schedule trigger: Add cron trigger for scheduled messaging\n- Integration: Connect with other n8n workflows for complex automation\n\n## API Endpoints Covered:\n- WhatsApp: Single message, media, bulk messaging\n- SMS: Regular, VIP, OTP, VVIP priority levels\n- Telegram: Text, image, document, location, buttons\n- AI Chat: Text, JSON, markdown responses\n- Presence: Set typing indicators and status\n- Profile: Get user account information\n\nFor more information visit: https://waconsole.apipedia.id"
}