n8n-backup/workflows/Shopify <--> Mautic.json

547 lines
13 KiB
JSON

{
"active": true,
"connections": {
"Email suchen": {
"main": [
[
{
"node": "Kontakt gefunden?",
"type": "main",
"index": 0
}
]
]
},
"Webhook1": {
"main": [
[
{
"node": "Move Binary Data",
"type": "main",
"index": 0
}
]
]
},
"Email vorhanden?": {
"main": [
[
{
"node": "Segment hinzufügen",
"type": "main",
"index": 0
}
],
[
{
"node": "Aus Segment entfernen",
"type": "main",
"index": 0
}
]
]
},
"GraphQL": {
"main": [
[
{
"node": "IF1",
"type": "main",
"index": 0
}
]
]
},
"IF1": {
"main": [
[
{
"node": "Abonniert",
"type": "main",
"index": 0
}
],
[
{
"node": "GraphQL2",
"type": "main",
"index": 0
}
]
]
},
"Mautic": {
"main": [
[
{
"node": "Email vorhanden?",
"type": "main",
"index": 0
}
]
]
},
"Kontakt gefunden?": {
"main": [
[
{
"node": "Email vorhanden?",
"type": "main",
"index": 0
}
],
[
{
"node": "Marketing Einwilligung?",
"type": "main",
"index": 0
}
]
]
},
"Marketing Einwilligung?": {
"main": [
[
{
"node": "Mautic",
"type": "main",
"index": 0
}
],
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
]
]
},
"Shopify Trigger": {
"main": [
[
{
"node": "Email suchen",
"type": "main",
"index": 0
}
]
]
},
"Crypto": {
"main": [
[
{
"node": "IF",
"type": "main",
"index": 0
}
]
]
},
"IF": {
"main": [
[
{
"node": "GraphQL",
"type": "main",
"index": 0
}
],
[
{
"node": "No Operation, do nothing1",
"type": "main",
"index": 0
}
]
]
},
"Move Binary Data": {
"main": [
[
{
"node": "Crypto",
"type": "main",
"index": 0
}
]
]
}
},
"createdAt": "2023-04-30T12:45:41.935Z",
"id": "11",
"name": "Shopify <--> Mautic",
"nodes": [
{
"parameters": {
"authentication": "oAuth2",
"operation": "getAll",
"limit": 1,
"options": {
"search": "={{ $json.email }}"
}
},
"id": "34c7436f-21b8-400a-b754-baacf1f38ec9",
"name": "Email suchen",
"type": "n8n-nodes-base.mautic",
"typeVersion": 1,
"position": [
240,
0
],
"alwaysOutputData": true,
"credentials": {
"mauticOAuth2Api": {
"id": "20",
"name": "Mautic account"
}
}
},
{
"parameters": {
"authentication": "oAuth2",
"resource": "contactSegment",
"operation": "remove",
"contactId": "={{ $json.id }}",
"segmentId": 1
},
"id": "0b888d2a-3790-4182-bf62-73d99a1614a6",
"name": "Aus Segment entfernen",
"type": "n8n-nodes-base.mautic",
"typeVersion": 1,
"position": [
1380,
100
],
"credentials": {
"mauticOAuth2Api": {
"id": "20",
"name": "Mautic account"
}
}
},
{
"parameters": {
"authentication": "oAuth2",
"resource": "contactSegment",
"contactId": "={{ $json.id }}",
"segmentId": 1
},
"id": "4db83f86-9ec7-41fa-8faf-7886eb539195",
"name": "Segment hinzufügen",
"type": "n8n-nodes-base.mautic",
"typeVersion": 1,
"position": [
1380,
-140
],
"credentials": {
"mauticOAuth2Api": {
"id": "20",
"name": "Mautic account"
}
}
},
{
"parameters": {
"httpMethod": "POST",
"path": "c83eb6ce-40dd-418c-952a-ed62a051a00b",
"options": {
"rawBody": true
}
},
"id": "4a01eed5-9378-47f3-98ab-e00848ba0093",
"name": "Webhook1",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
40,
840
],
"webhookId": "c83eb6ce-40dd-418c-952a-ed62a051a00b"
},
{
"parameters": {
"authentication": "headerAuth",
"endpoint": "https://lana-kk.myshopify.com/admin/api/2022-01/graphql.json",
"requestFormat": "json",
"query": "={\n customers(first: 1, query: \"email:'{{ $json[\"body\"][\"mautic.lead_channel_subscription_changed\"][0][\"contact\"][\"fields\"][\"core\"][\"email\"][\"value\"] }}'\" ) {\n edges {\n node {\n id\n email\n marketingOptInLevel\n }\n }\n }\n}"
},
"id": "1bc94c14-ceda-42e1-94dc-1ac91ac72f8b",
"name": "GraphQL",
"type": "n8n-nodes-base.graphql",
"typeVersion": 1,
"position": [
940,
700
],
"credentials": {
"httpHeaderAuth": {
"id": "14",
"name": "Shopify lanakk.com"
}
}
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "= {{ $node.Webhook1.json.body[\"mautic.lead_channel_subscription_changed\"][0].new_status }}",
"operation": "regex",
"value2": "=contactable"
}
]
},
"combineOperation": "any"
},
"id": "162ccd38-f38c-4a76-8e56-1ab52b89601e",
"name": "IF1",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1180,
700
]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ $node[\"Shopify Trigger\"].json[\"accepts_marketing\"] }}",
"value2": "={{ true }}"
}
]
}
},
"id": "47173c1e-7a30-41c3-902d-3c271608c5e5",
"name": "Email vorhanden?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1140,
-20
]
},
{
"parameters": {
"authentication": "headerAuth",
"endpoint": "https://lana-kk.myshopify.com/admin/api/2023-04/graphql.json",
"requestFormat": "json",
"query": "=mutation customerEmailMarketingConsentUpdate($input: CustomerEmailMarketingConsentUpdateInput!) {\n customerEmailMarketingConsentUpdate(input: $input) {\n customer {\n id\n }\n userErrors {\n field\n message\n }\n }\n}",
"variables": "={ \"input\": { \"customerId\": \"{{ $node[\"GraphQL\"].json[\"data\"][\"customers\"][\"edges\"][0][\"node\"][\"id\"] }}\", \"emailMarketingConsent\": { \"consentUpdatedAt\": \"{{ $now }}\", \"marketingOptInLevel\": \"SINGLE_OPT_IN\", \"marketingState\": \"UNSUBSCRIBED\" } }}"
},
"id": "d634f91d-8688-4503-9654-12a699e4dad6",
"name": "GraphQL2",
"type": "n8n-nodes-base.graphql",
"typeVersion": 1,
"position": [
1420,
840
],
"credentials": {
"httpHeaderAuth": {
"id": "14",
"name": "Shopify lanakk.com"
}
}
},
{
"parameters": {
"authentication": "headerAuth",
"endpoint": "https://lana-kk.myshopify.com/admin/api/2023-04/graphql.json",
"requestFormat": "json",
"query": "=mutation customerEmailMarketingConsentUpdate($input: CustomerEmailMarketingConsentUpdateInput!) {\n customerEmailMarketingConsentUpdate(input: $input) {\n customer {\n id\n }\n userErrors {\n field\n message\n }\n }\n}",
"variables": "={ \"input\": { \"customerId\": \"{{ $node[\"GraphQL\"].json[\"data\"][\"customers\"][\"edges\"][0][\"node\"][\"id\"] }}\", \"emailMarketingConsent\": { \"consentUpdatedAt\": \"{{ $now }}\", \"marketingOptInLevel\": \"SINGLE_OPT_IN\", \"marketingState\": \"SUBSCRIBED\" } }}"
},
"id": "dcf79e78-d4ba-4a55-bbc0-840c5c01dae4",
"name": "Abonniert",
"type": "n8n-nodes-base.graphql",
"typeVersion": 1,
"position": [
1420,
560
],
"credentials": {
"httpHeaderAuth": {
"id": "14",
"name": "Shopify lanakk.com"
}
}
},
{
"parameters": {
"authentication": "oAuth2",
"email": "={{ $node[\"Webhook\"].json[\"body\"][\"email\"] }}",
"firstName": "={{ $node[\"Webhook\"].json[\"body\"][\"first_name\"] }}",
"lastName": "={{ $node[\"Webhook\"].json[\"body\"][\"last_name\"] }}",
"company": "=",
"additionalFields": {},
"options": {}
},
"id": "72dff69d-d130-4533-979f-341c220925d1",
"name": "Mautic",
"type": "n8n-nodes-base.mautic",
"typeVersion": 1,
"position": [
940,
140
],
"credentials": {
"mauticOAuth2Api": {
"id": "20",
"name": "Mautic account"
}
}
},
{
"parameters": {},
"id": "9e72fd94-5416-4186-9738-0b1a19330f2c",
"name": "No Operation, do nothing",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
940,
340
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.id }}",
"operation": "isNotEmpty"
}
]
}
},
"id": "d81ac980-1063-462f-9812-44239e6fc49d",
"name": "Kontakt gefunden?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
460,
0
],
"alwaysOutputData": false
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ $node.Webhook.json.body.accepts_marketing }}",
"value2": "={{ true }}"
}
]
}
},
"id": "580be6e1-8658-4741-b52a-43d22faa7e23",
"name": "Marketing Einwilligung?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
660,
160
]
},
{
"parameters": {
"authentication": "accessToken",
"topic": "customers/update"
},
"id": "e34a2cf2-8ee5-4cb9-9a9c-9ecd422107df",
"name": "Shopify Trigger",
"type": "n8n-nodes-base.shopifyTrigger",
"typeVersion": 1,
"position": [
40,
0
],
"webhookId": "ebce58fc-45cf-4c1c-8427-3ffbaccdb440",
"credentials": {
"shopifyAccessTokenApi": {
"id": "25",
"name": "Shopify Access Token account"
}
}
},
{
"parameters": {
"action": "hmac",
"type": "SHA256",
"value": "={{ $json.data }}",
"dataPropertyName": "=key",
"secret": "0a9dcfe4f362625efc5a38bc709598c61869552fcfc1aceb8fc08edad8dd3825",
"encoding": "base64"
},
"id": "31deaf45-706d-4bcc-b92a-1f0ed7f8ff9e",
"name": "Crypto",
"type": "n8n-nodes-base.crypto",
"typeVersion": 1,
"position": [
460,
840
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json[\"headers\"][\"webhook-signature\"] }}",
"value2": "={{ $json.key }}"
}
]
}
},
"id": "dec9961f-d754-4d87-980f-61853ea66a14",
"name": "IF",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
680,
840
]
},
{
"parameters": {
"setAllData": false,
"options": {}
},
"id": "cfff982c-953b-49fd-8d43-340ca7a1f447",
"name": "Move Binary Data",
"type": "n8n-nodes-base.moveBinaryData",
"typeVersion": 1,
"position": [
240,
840
]
},
{
"parameters": {},
"id": "9f471b45-d736-494d-9221-49c45f700c8b",
"name": "No Operation, do nothing1",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
940,
1000
]
}
],
"pinData": {},
"settings": {},
"staticData": {
"node:Shopify Trigger": {
"webhookId": 1277448028425
}
},
"tags": [],
"triggerCount": 2,
"updatedAt": "2023-06-28T11:10:33.000Z",
"versionId": "f04dd5cd-8f9e-4f54-a16c-51ffdb54b3b0"
}