{
  "name": "Sync Dartagnan email templates to Braze",
  "nodes": [
    {
      "id": "1562791c-33a9-425c-a774-32e328bd4715",
      "name": "Token Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        60,
        200
      ]
    },
    {
      "id": "2d81394c-9898-419a-a832-339e66d56a29",
      "name": "Assign Credentials",
      "type": "n8n-nodes-base.set",
      "position": [
        -400,
        300
      ]
    },
    {
      "id": "b80a8eda-bbf6-4560-8665-5128a97db217",
      "name": "Dartagnan Project list",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        360,
        200
      ]
    },
    {
      "id": "909eb4f9-d67e-4f5e-bdb6-67ef2da813a4",
      "name": "Create email template",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2420,
        400
      ]
    },
    {
      "id": "0820220a-5ea6-42eb-bfd2-f697dcf37a8a",
      "name": "List Available Email Template Braze",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        60,
        420
      ]
    },
    {
      "id": "dcfec31d-c42c-4545-91a0-3b2e3350d375",
      "name": "Filtered Project Campaign",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        640,
        200
      ]
    },
    {
      "id": "1aba6e4c-d3b0-49f8-8bcb-bece8cce4b4d",
      "name": "Filtering Dartagnan Campaigns",
      "type": "n8n-nodes-base.set",
      "position": [
        840,
        200
      ]
    },
    {
      "id": "ee26ca98-2c42-4e69-ab34-cc2d737c22f8",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        360,
        420
      ]
    },
    {
      "id": "08d8372f-38cb-4722-95aa-c89bfcc36dff",
      "name": "Filtering Braze Email Template",
      "type": "n8n-nodes-base.set",
      "position": [
        800,
        420
      ]
    },
    {
      "id": "3e07fa37-8afd-4d88-85a3-53a4f000f898",
      "name": "Not existing In Braze",
      "type": "n8n-nodes-base.merge",
      "position": [
        1160,
        420
      ]
    },
    {
      "id": "210a9d44-f58f-4788-89bd-934dfc0fca41",
      "name": "Existing In Braze",
      "type": "n8n-nodes-base.merge",
      "position": [
        1140,
        200
      ]
    },
    {
      "id": "59f8270b-b988-452b-aaf0-0e7b35490449",
      "name": "Dartagnan HTML & MEDIA To Update",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1740,
        180
      ]
    },
    {
      "id": "04b26314-cb00-4a90-a7fe-019936a5ba2a",
      "name": "Encode Content To Update",
      "type": "n8n-nodes-base.set",
      "position": [
        2180,
        180
      ]
    },
    {
      "id": "1455fd2e-85ee-4844-8c4b-755870dc9cee",
      "name": "Dartagnan HTML & MEDIA Campagne to Create",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1760,
        400
      ]
    },
    {
      "id": "214d8b4b-c512-4d1f-8115-8491f6fc9272",
      "name": "Encode Content to Create",
      "type": "n8n-nodes-base.set",
      "position": [
        2200,
        400
      ]
    },
    {
      "id": "90158667-eeda-4d44-b45c-c6e7fa02e664",
      "name": "If campaign is modified recently",
      "type": "n8n-nodes-base.if",
      "position": [
        1420,
        200
      ]
    },
    {
      "id": "55aecc9b-d5a6-4a6b-a986-3ddfae200b94",
      "name": "Filter Braze vs Dartagnan",
      "type": "n8n-nodes-base.if",
      "position": [
        1440,
        420
      ]
    },
    {
      "id": "ff2a47df-983f-42f5-9c96-431fccbdb8ef",
      "name": "Embed image in HTML",
      "type": "n8n-nodes-base.code",
      "position": [
        1960,
        180
      ]
    },
    {
      "id": "0fbdb7d6-64a3-40ae-8187-8afcb76451e8",
      "name": "Embed image in HTML 1",
      "type": "n8n-nodes-base.code",
      "position": [
        1960,
        400
      ]
    },
    {
      "id": "89acf2f3-940b-47e9-81e3-2d458d3018ee",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -460,
        80
      ],
      "parameters": {
        "width": null,
        "height": 400,
        "content": "## Authentication Set Up\n\nObtain an access token from Dartagnan\nPrepare credentials for both Dartagnan and Braze"
      }
    },
    {
      "id": "317cd699-6686-42a0-ba6d-8f6405338356",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        60,
        480
      ],
      "parameters": {
        "width": 960,
        "height": 380,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Template Discovery\n\n\nList all existing email templates in Braze"
      }
    },
    {
      "id": "d59b0dac-439e-4160-8879-b306ccd18773",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 260,
        "height": 380,
        "content": "## Authentication Token\n\nObtain an access token from Dartagnan"
      }
    },
    {
      "id": "dc38ec97-ca50-4944-89f1-535f23420cfc",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        300,
        0
      ],
      "parameters": {
        "width": 460,
        "height": 380,
        "content": "## Template Discovery\n\nRetrieve project and campaign details from Dartagnan\n"
      }
    },
    {
      "id": "5fd7d7dc-f314-411a-ba0a-4af14874f96b",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        0
      ],
      "parameters": {
        "width": 600,
        "height": 680,
        "content": "## Comparison and Sync\n\nCompare Dartagnan templates with existing Braze templates\nIdentify templates to update (top Branch) or create ( Lower Branch)"
      }
    },
    {
      "id": "e198dca0-0278-4b67-9807-90796ff2d644",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1660,
        0
      ],
      "parameters": {
        "width": 980,
        "height": 680,
        "content": "## Template Processing\n\nExtract HTML and media from Dartagnan templates\nReplace image references with direct URLs\nPrepare templates for Braze\nUpdate existing templates in Braze ( upper branch ) \nCreat"
      }
    },
    {
      "id": "321eb50a-66a2-4951-b61b-e0869a91b6a0",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -980,
        80
      ],
      "parameters": {
        "width": 460,
        "height": 380,
        "content": "## Trigger\n\nTrigger is scheduled to run every 5 minutes, you can change this, but bear in mind to stay in the API rate limits of each vendor\n"
      }
    },
    {
      "id": "8e0984c5-ec70-4ca5-97fe-0bdd24acd95c",
      "name": "Every 5 minutes start",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -660,
        300
      ]
    },
    {
      "id": "adb2c227-d27e-44fc-8f6e-0b3d02952ef9",
      "name": "Update existing email template in Braze",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2400,
        180
      ]
    }
  ],
  "connections": {
    "Split Out": {
      "main": [
        [
          {
            "node": "Filtering Braze Email Template",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Token Request": {
      "main": [
        [
          {
            "node": "Dartagnan Project list",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Existing In Braze": {
      "main": [
        [
          {
            "node": "If campaign is modified recently",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Assign Credentials": {
      "main": [
        [
          {
            "node": "List Available Email Template Braze",
            "type": "main",
            "index": 0
          },
          {
            "node": "Token Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embed image in HTML": {
      "main": [
        [
          {
            "node": "Encode Content To Update",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embed image in HTML 1": {
      "main": [
        [
          {
            "node": "Encode Content to Create",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Every 5 minutes start": {
      "main": [
        [
          {
            "node": "Assign Credentials",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Not existing In Braze": {
      "main": [
        [
          {
            "node": "Filter Braze vs Dartagnan",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Dartagnan Project list": {
      "main": [
        [
          {
            "node": "Filtered Project Campaign",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Encode Content To Update": {
      "main": [
        [
          {
            "node": "Update existing email template in Braze",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Encode Content to Create": {
      "main": [
        [
          {
            "node": "Create email template",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Braze vs Dartagnan": {
      "main": [
        [
          {
            "node": "Dartagnan HTML & MEDIA Campagne to Create",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filtered Project Campaign": {
      "main": [
        [
          {
            "node": "Filtering Dartagnan Campaigns",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filtering Dartagnan Campaigns": {
      "main": [
        [
          {
            "node": "Existing In Braze",
            "type": "main",
            "index": 0
          },
          {
            "node": "Not existing In Braze",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filtering Braze Email Template": {
      "main": [
        [
          {
            "node": "Existing In Braze",
            "type": "main",
            "index": 1
          },
          {
            "node": "Not existing In Braze",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Dartagnan HTML & MEDIA To Update": {
      "main": [
        [
          {
            "node": "Embed image in HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If campaign is modified recently": {
      "main": [
        [
          {
            "node": "Dartagnan HTML & MEDIA To Update",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Available Email Template Braze": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Dartagnan HTML & MEDIA Campagne to Create": {
      "main": [
        [
          {
            "node": "Embed image in HTML 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}