{
  "name": "Multi-channel campaign messaging with GPT-4 and Salesforce",
  "nodes": [
    {
      "id": "2d468c09-fe3a-4c8a-b4af-817a762a8d7a",
      "name": "Send SMS",
      "type": "n8n-nodes-base.twilio",
      "position": [
        -60,
        420
      ]
    },
    {
      "id": "ad400bf5-b77d-4f76-be46-fe6cc76e5a0c",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -660,
        720
      ]
    },
    {
      "id": "b9e3bee1-83c7-4a60-94fe-110236d0c8a9",
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -64,
        620
      ]
    },
    {
      "id": "d89a36de-0978-430e-a248-a7cd7e73ee37",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        156,
        720
      ]
    },
    {
      "id": "649c91de-560e-47e4-b498-217246ced614",
      "name": "Fetch Campaign",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        -1100,
        720
      ]
    },
    {
      "id": "f5a813de-06b0-40a8-baff-1a51a9857647",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1180,
        520
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "## Fetch Campaigns\n\nRetrieve campaigns that still require processing.\n\n\n\n\n\n\n\n\n\n"
      }
    },
    {
      "id": "d208f08e-6fc8-47fa-a1e1-e2bcae764d5e",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -920,
        460
      ],
      "parameters": {
        "width": null,
        "height": 220,
        "content": "## Fetch Campaign Members\nRetrieve all members associated with the campaigns returned in the previous step. Make the specific query ID for your Campaign\n\n\n\n\n\n\n\n\n\n"
      }
    },
    {
      "id": "ca76386b-6908-4541-9ff2-8fb69b3237a2",
      "name": "Fetch Campaign Members",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        -880,
        720
      ]
    },
    {
      "id": "e72ebcee-0d97-4e57-b0f8-167ea0fe9d27",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -660,
        440
      ],
      "parameters": {
        "width": null,
        "height": 240,
        "content": "## Generate Personalized Messages\nUse OpenAI to convert each campaign’s description into tailored messages for every member, selecting the appropriate channel (SMS, Email, WhatsApp, or Telegram)."
      }
    },
    {
      "id": "553f9b9b-20f2-4ead-a2d1-1111c21bf176",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        520
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "## Communication Method Mapping\nAssign channel codes as follows: SMS = 0, Email = 1, WhatsApp = 2, Telegram = 3.\n\n\n\n\n\n\n\n\n\nAsk ChatGPT\n"
      }
    },
    {
      "id": "44581a57-558b-4aa6-a27d-e03e62fc9393",
      "name": "Communication Method Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -284,
        699
      ]
    },
    {
      "id": "4ac45980-237a-41ba-adcd-f3cd6945699d",
      "name": "Send Whatsapp",
      "type": "n8n-nodes-base.twilio",
      "position": [
        -64,
        820
      ]
    },
    {
      "id": "44bf7301-b466-48aa-b1c8-490fd8cb6e01",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        480
      ],
      "parameters": {
        "width": null,
        "height": 220,
        "content": "## Mark Campaign Members as Processed\nUpdate each CampaignMember record to indicate that the personalized message has been generated and the member has been processed."
      }
    },
    {
      "id": "0e592700-06db-4cc9-ad37-924360f113a6",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1320,
        720
      ]
    }
  ],
  "connections": {
    "OpenAI": {
      "main": [
        [
          {
            "node": "Communication Method Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send SMS": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Email": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Whatsapp": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Campaign": {
      "main": [
        [
          {
            "node": "Fetch Campaign Members",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Fetch Campaign",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Campaign Members": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Communication Method Switch": {
      "main": [
        [
          {
            "node": "Send SMS",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Whatsapp",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}