{
  "name": "Sync customer email subscriptions between Shopify and Mautic",
  "nodes": [
    {
      "id": "592b2608-e77e-4988-8f77-8820645b56ee",
      "name": "Shopify Trigger",
      "type": "n8n-nodes-base.shopifyTrigger",
      "position": [
        540,
        320
      ]
    },
    {
      "id": "f2e6931d-0279-4142-9b9e-1092657d91e2",
      "name": "Accepts Marketing?",
      "type": "n8n-nodes-base.if",
      "position": [
        1240,
        180
      ]
    },
    {
      "id": "2a31657b-f1b3-4e4a-8f6a-3d3ee15aa052",
      "name": "Accepts Marketing?1",
      "type": "n8n-nodes-base.if",
      "position": [
        1240,
        500
      ]
    },
    {
      "id": "266a07ca-915a-4afd-9a0a-60eb974ee263",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1540,
        720
      ]
    },
    {
      "id": "b9aee974-4d75-4b1e-80b7-8aab9d4f403d",
      "name": "Add to confirmed segment",
      "type": "n8n-nodes-base.mautic",
      "position": [
        1840,
        40
      ]
    },
    {
      "id": "a0fbd9e7-a60d-430b-b5df-4ec063e181c9",
      "name": "Remove from confirmed segment",
      "type": "n8n-nodes-base.mautic",
      "position": [
        1840,
        300
      ]
    },
    {
      "id": "0bc8fc06-3bf5-4c49-acc2-1ed499a07ea1",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        540,
        1500
      ]
    },
    {
      "id": "001eff12-6f14-4fb2-afdd-e6b7956437bf",
      "name": "Crypto",
      "type": "n8n-nodes-base.crypto",
      "position": [
        760,
        1500
      ]
    },
    {
      "id": "6cde7c3c-e1f9-4584-908c-9b4a82e4f2a4",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        980,
        1500
      ]
    },
    {
      "id": "e848a1d3-2f9b-4d27-8862-b3284654f818",
      "name": "No Operation, do nothing1",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1260,
        1700
      ]
    },
    {
      "id": "ff27ee31-c13d-4a52-a260-aef9df8c64a6",
      "name": "GraphQL",
      "type": "n8n-nodes-base.graphql",
      "position": [
        1260,
        1480
      ]
    },
    {
      "id": "168b255b-f796-426c-80fd-c2fe79ef973f",
      "name": "Marketing Consent - subscribed",
      "type": "n8n-nodes-base.graphql",
      "position": [
        2120,
        1160
      ]
    },
    {
      "id": "f7db8ec3-27d4-41f7-a0c9-6249bf6e805a",
      "name": "Marketing Consent - unsubscribed",
      "type": "n8n-nodes-base.graphql",
      "position": [
        2120,
        1500
      ]
    },
    {
      "id": "ff62697d-29d0-4b7e-b695-cd90535e5fa8",
      "name": "Mautic - Accepts Marketing?",
      "type": "n8n-nodes-base.if",
      "position": [
        1820,
        1180
      ]
    },
    {
      "id": "8515256f-c49b-4000-9a1e-be9958720dd6",
      "name": "Customer exists?",
      "type": "n8n-nodes-base.if",
      "position": [
        1540,
        1480
      ]
    },
    {
      "id": "616ae364-82a0-456a-abaf-b8855ca56f8f",
      "name": "No Operation, do nothing2",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1820,
        1640
      ]
    },
    {
      "id": "afdeb330-06d0-4fdf-9f42-1d8ce74d483d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        540,
        1680
      ],
      "parameters": {
        "width": 580.807881773399,
        "height": null,
        "content": "## Webhook Validation\nWe use the same key shared with Mautic to hash the incoming request. If the computed hash is identical to the one delivered the request is valid and can be processed"
      }
    },
    {
      "id": "38633539-cc9a-4bde-92f7-39e697bd803f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2040,
        40
      ],
      "parameters": {
        "width": 279.1188177339898,
        "height": 383.7477832512317,
        "content": "## Mautic Segments\nThe n8n Shopify node cannot Please make sure to select your segment on both nodes"
      }
    },
    {
      "id": "4107ce14-58bc-4171-87bb-5fc74a506e38",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1080,
        1300
      ],
      "parameters": {
        "width": 279.1188177339898,
        "height": null,
        "content": "## Shopify \nThe n8n Shopify node cannot get customer marketing consent, so we get this from the Shopify GraphQL API"
      }
    },
    {
      "id": "33f97be7-a4bf-42ee-96ae-dbbe54f5248f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        580,
        1140
      ],
      "parameters": {
        "width": 279.1188177339898,
        "height": null,
        "content": "## Set your Shopify Subdomain here"
      }
    },
    {
      "id": "7f203946-a365-44a3-8de0-1fe0b1964eab",
      "name": "Set Shopify Subdomain",
      "type": "n8n-nodes-base.set",
      "position": [
        760,
        1320
      ]
    },
    {
      "id": "544a4da2-11a4-465b-a30e-02ed618a77a6",
      "name": "Search for Contact by Email",
      "type": "n8n-nodes-base.mautic",
      "position": [
        760,
        320
      ]
    },
    {
      "id": "1332db6d-99ab-4d38-89b8-7f7ba25d4cf1",
      "name": "Contact exists?",
      "type": "n8n-nodes-base.if",
      "position": [
        980,
        320
      ]
    },
    {
      "id": "488494df-6e8c-4f8c-b7ed-5d6d67f083c8",
      "name": "Create a new contact",
      "type": "n8n-nodes-base.mautic",
      "position": [
        1540,
        480
      ]
    },
    {
      "id": "586c736b-cd46-4c5c-ac2f-c4380cf465bb",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        1420
      ],
      "parameters": {
        "width": 360.408084305475,
        "height": 315.5897364788551,
        "content": "## Mautic to Shopify\n\nThis part uses GraphQL calls to the Shopify Admin API. In order to get a better understanding for the queries and mutations please check the API Docs.\n\nExamples from the Shopify "
      }
    },
    {
      "id": "47e8a011-b2ba-4839-ac85-24dd45e18020",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        20,
        220
      ],
      "parameters": {
        "width": 360.408084305475,
        "height": 315.5897364788551,
        "content": "## Shopify to Mautic\n\nThis part uses the Shopify Trigger to watch for changes on customer data.\n\nTo use the Mautic nodes please make sure you have the API enabled in your Mautic Instance."
      }
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "GraphQL",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Crypto": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GraphQL": {
      "main": [
        [
          {
            "node": "Customer exists?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Crypto",
            "type": "main",
            "index": 0
          },
          {
            "node": "Set Shopify Subdomain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Contact exists?": {
      "main": [
        [
          {
            "node": "Accepts Marketing?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Accepts Marketing?1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shopify Trigger": {
      "main": [
        [
          {
            "node": "Search for Contact by Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Customer exists?": {
      "main": [
        [
          {
            "node": "Mautic - Accepts Marketing?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Accepts Marketing?": {
      "main": [
        [
          {
            "node": "Add to confirmed segment",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Remove from confirmed segment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Accepts Marketing?1": {
      "main": [
        [
          {
            "node": "Create a new contact",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a new contact": {
      "main": [
        [
          {
            "node": "Add to confirmed segment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mautic - Accepts Marketing?": {
      "main": [
        [
          {
            "node": "Marketing Consent - subscribed",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Marketing Consent - unsubscribed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search for Contact by Email": {
      "main": [
        [
          {
            "node": "Contact exists?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}