API de conversion Facebook-Meta pour des prospects et commandes de commerce électronique

Avancé

Ceci est unAIworkflow d'automatisation du domainecontenant 17 nœuds.Utilise principalement des nœuds comme Set, Code, Webhook, ManualTrigger, FacebookGraphApi, combinant la technologie d'intelligence artificielle pour une automatisation intelligente. Facebook/Meta 转化API电商线索/commandetraitement

Prérequis
  • Point de terminaison HTTP Webhook (généré automatiquement par n8n)
  • Informations d'identification Facebook Graph API
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "meta": {
    "instanceId": "66ce8bb89c7868f862e0d2e755cd17c6a5aea7904e5504a5b2e292e317980443"
  },
  "nodes": [
    {
      "id": "7fd5ddfd-a858-4a0a-84b8-f8f4ec034d63",
      "name": "Normaliser les données",
      "type": "n8n-nodes-base.set",
      "position": [
        -60,
        0
      ],
      "parameters": {
        "include": "except",
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "65d1994d-f4b8-478a-8cf1-490990e6639d",
              "name": "user_data.phone",
              "type": "string",
              "value": "={{$json.user_data.phone.replace(/\\D/g, '').replace(/^0+/, '')}}"
            },
            {
              "id": "5650546d-f0ad-4c69-829c-3e4283e16ac7",
              "name": "event_time",
              "type": "number",
              "value": "={{Math.floor(new Date($json.event_time).getTime() / 1000)}}"
            },
            {
              "id": "9475d631-348f-4d53-9e75-0d568654aeef",
              "name": "user_data.first_name",
              "type": "string",
              "value": "={{$json.user_data.first_name}}"
            },
            {
              "id": "77a8f321-abf9-4618-8fb2-ef5d567a9cd1",
              "name": "user_data.last_name",
              "type": "string",
              "value": "={{$json.user_data.last_name}}"
            }
          ]
        },
        "excludeFields": "user_data.name",
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "978d3854-44f6-4773-928e-4536a97a48b1",
      "name": "Note adhésive1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -180,
        -60
      ],
      "parameters": {
        "color": 7,
        "width": 343,
        "height": 252,
        "content": "## Data normalization"
      },
      "typeVersion": 1
    },
    {
      "id": "feb4a686-278f-41d4-ab13-ba4fbc159ef6",
      "name": "Chiffrer les données",
      "type": "n8n-nodes-base.set",
      "position": [
        300,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "097ed7ff-c076-454e-930c-1f4820ac6e2e",
              "name": "user_data.first_name",
              "type": "string",
              "value": "={{ $json.user_data.first_name.hash(\"sha256\") }}"
            },
            {
              "id": "e285fa12-d272-48a0-a583-5e90b394fd74",
              "name": "user_data.last_name",
              "type": "string",
              "value": "={{ $json.user_data.last_name.hash(\"sha256\") }}"
            },
            {
              "id": "1e87a997-5b78-48d8-9616-edfb1b910743",
              "name": "user_data.phone",
              "type": "string",
              "value": "={{ $json.user_data.phone.hash(\"sha256\") }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "1beb8a7c-0bce-489a-aea4-c2acb937601f",
      "name": "Note adhésive2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        180,
        -60
      ],
      "parameters": {
        "color": 7,
        "width": 343,
        "height": 252,
        "content": "## Data encryption\n"
      },
      "typeVersion": 1
    },
    {
      "id": "9f867c8b-fdc1-4294-b56e-12340c604111",
      "name": "Note adhésive3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        680,
        -220
      ],
      "parameters": {
        "color": 7,
        "width": 375,
        "height": 414,
        "content": "## Send event\nYou can use a test code from Facebook Events Manager to verify your integration.\n\nAdd your test code to the test_code parameter inside the JSON payload.\n\nOnce everything is confirmed to be working, remove the test_event_code so that events are officially logged.\n\n[**Read more**](https://business.facebook.com/business/help/2040882565969969)"
      },
      "typeVersion": 1
    },
    {
      "id": "c00c1fac-7550-4fa9-8fc9-e9f250519e6a",
      "name": "Envoyer l'événement à Meta",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        820,
        20
      ],
      "parameters": {
        "edge": "events",
        "node": "={{$('Format data').item.json.pixel_id}}",
        "options": {
          "queryParametersJson": "={\n  \"data\": [\n    {\n      \"event_name\": \"{{ $('Encrypt data').item.json.event_name }}\",\n      \"event_time\": {{ $('Encrypt data').item.json.event_time }},\n      \"event_source_url\": \"{{ $('Encrypt data').item.json.event_source_url }}\",\n      \"action_source\": \"{{ $('Encrypt data').item.json.action_source }}\",\n      \"user_data\": {\n        \"em\": \"{{ $('Encrypt data').item.json.user_data.email }}\",\n        \"ph\": \"{{ $('Encrypt data').item.json.user_data.phone }}\",\n        \"fn\": \"{{ $('Encrypt data').item.json.user_data.first_name }}\",\n        \"ln\": \"{{ $('Encrypt data').item.json.user_data.last_name }}\",\n        \"fbc\": \"{{ $('Encrypt data').item.json.user_data.fbp }}\",\n        \"fbp\": \"{{ $('Encrypt data').item.json.user_data.fbc }}\",\n        \"ip\": \"{{ $('Encrypt data').item.json.user_data.ip }}\",\n        \"user_agent\": \"{{ $('Encrypt data').item.json.user_data.user_agent }}\"\n      },\n      \"custom_data\": {\n        \"value\": {{ $('Encrypt data').item.json.custom_data.value }},\n        \"currency\": \"{{ $('Encrypt data').item.json.custom_data.currency }}\"\n      }\n    }\n  ],\n  \"test_event_code\": \"TEST1337\"\n}\n"
        },
        "graphApiVersion": "=v20.0",
        "httpRequestMethod": "POST"
      },
      "credentials": {
        "facebookGraphApi": {
          "id": "ThsFZDy4veCJfHRP",
          "name": "Meta conversion api (WIJDANPROMO)"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5b486767-1ec1-4829-a556-ddc4f0c13f95",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1260,
        -240
      ],
      "webhookId": "b408defb-315d-4676-b4c4-1dcebe81ffc0",
      "parameters": {
        "path": "b408defb-315d-4676-b4c4-1dcebe81ffc0",
        "options": {},
        "httpMethod": [
          "POST",
          "GET"
        ],
        "multipleMethods": true
      },
      "typeVersion": 2
    },
    {
      "id": "8a8ee5fb-edf4-410c-b86c-a1b805a66319",
      "name": "Note adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1160,
        100
      ],
      "parameters": {
        "height": 220,
        "content": "## Test data \nYou can chenge test data here"
      },
      "typeVersion": 1
    },
    {
      "id": "40240bfc-8e7b-4c5b-84e0-b8ccd52b097e",
      "name": "Tester les données",
      "type": "n8n-nodes-base.code",
      "position": [
        -1100,
        180
      ],
      "parameters": {
        "jsCode": "return {\n  \"body\": {\n    'first_name': \"Alex\",\n    'last_name': \"Forbic\",\n    'phone': \"+116435562\",\n    'ip': \"16.115.243.190\",\n    'user_agent': \"Mozilla/5.0 (Linux; Android 14; SM-A065F Build/UP1A.231005.007; )\",\n    'fbp': \"fb.1.1750638230973.IwZXh0bgNhZW0BMABhZGlkAasgzcY0SboBHlIpXRPFXRua8Udfs9qnBwf4GN3xGWPk9HvipTCJeUYt8jaENcQyAm_TYaYITPrWtzJcJ8e38-CMQ\",\n    'fbc': \"fb.1.1750612363841.918837434857767253\",\n    'created_at': \"2025-06-18T15:24:06.000000Z\",\n    'amount': 120,\n    'currency': \"EUR\"\n  }\n};"
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "dbb5d646-4500-4ed9-89b6-607ebfc216d9",
      "name": "Note adhésive5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1620,
        80
      ],
      "parameters": {
        "height": 240,
        "content": "## Test Workflow\nClick this button to test the workflow with fake data \n"
      },
      "typeVersion": 1
    },
    {
      "id": "8473264d-fbad-4213-a0bf-84e7f841053e",
      "name": "Exécuter le workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1540,
        180
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "ad465243-cb30-492d-b77c-1066fec33c1b",
      "name": "Note adhésive6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -220
      ],
      "parameters": {
        "color": 7,
        "width": 340,
        "height": 80,
        "content": "## Change here\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1b1c1cd5-ecfe-40d2-af82-1b0cc2b65e7c",
      "name": "Note adhésive4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -120
      ],
      "parameters": {
        "color": 7,
        "width": 343,
        "height": 312,
        "content": "## Collect data\nIn this node you link between your webhook data with this node parameters, also you can add more data."
      },
      "typeVersion": 1
    },
    {
      "id": "63208dd1-6258-4630-9c3b-c8913cf04085",
      "name": "Formatter les données",
      "type": "n8n-nodes-base.code",
      "position": [
        -520,
        0
      ],
      "parameters": {
        "jsCode": "return [\n  {\n    json: {\n      event_name: \"Purchase\",\n      pixel_id:'1714041194725552', // you pixel ID\n      user_data: {\n        first_name: $input.first().json.body.first_name, // your customer first_name\n        last_name: $input.first().json.body.last_name, // your customer last_name\n        phone: $input.first().json.body.phone, // your customer phone\n        ip: $input.first().json.body.ip, // your customer IP\n        user_agent: $input.first().json.body.user_agent, // your customer User agent\n        fbp: $input.first().json.body.fbp, // your customer fbp\n        fbc: $input.first().json.body.fbc // your customer fbc\n      },\n      event_time: $input.first().json.body.created_at, // order Date like 2025-06-18T15:24:06.000000Z\n      custom_data: {\n        value: $input.first().json.body.amount, // pricing\n        currency: $input.first().json.body.currency\n      },\n      action_source: \"website\",\n      event_source_url: \"https://example.com/thanks\"\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "81bb1144-9e20-41d2-a611-c5f2422cba09",
      "name": "Note adhésive7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        360
      ],
      "parameters": {
        "color": 4,
        "width": 1700,
        "height": 100,
        "content": "## Do you need more help or have any suggestions?\nContact me at mediaplus.ma@gmail.com"
      },
      "typeVersion": 1
    },
    {
      "id": "a959b199-3d42-4a97-9c59-17cfa0b48124",
      "name": "Note adhésive8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1620,
        340
      ],
      "parameters": {
        "width": 700,
        "height": 80,
        "content": "## Just to test"
      },
      "typeVersion": 1
    },
    {
      "id": "541e0afe-1fd4-4c5e-a8e9-d7aa6f0e5832",
      "name": "Note adhésive9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1300,
        -320
      ],
      "parameters": {
        "color": 4,
        "width": 200,
        "height": 240,
        "content": "## Production"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "5b486767-1ec1-4829-a556-ddc4f0c13f95": {
      "main": [
        [
          {
            "node": "63208dd1-6258-4630-9c3b-c8913cf04085",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "40240bfc-8e7b-4c5b-84e0-b8ccd52b097e": {
      "main": [
        [
          {
            "node": "63208dd1-6258-4630-9c3b-c8913cf04085",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "63208dd1-6258-4630-9c3b-c8913cf04085": {
      "main": [
        [
          {
            "node": "7fd5ddfd-a858-4a0a-84b8-f8f4ec034d63",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "feb4a686-278f-41d4-ab13-ba4fbc159ef6": {
      "main": [
        [
          {
            "node": "c00c1fac-7550-4fa9-8fc9-e9f250519e6a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7fd5ddfd-a858-4a0a-84b8-f8f4ec034d63": {
      "main": [
        [
          {
            "node": "feb4a686-278f-41d4-ab13-ba4fbc159ef6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8473264d-fbad-4213-a0bf-84e7f841053e": {
      "main": [
        [
          {
            "node": "40240bfc-8e7b-4c5b-84e0-b8ccd52b097e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Avancé - Intelligence Artificielle

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Avancé
Nombre de nœuds17
Catégorie1
Types de nœuds6
Description de la difficulté

Adapté aux utilisateurs avancés, avec des workflows complexes contenant 16+ nœuds

Auteur
Omar Akoudad

Omar Akoudad

@mediaplusma

Automation, Code, and Analytics for E-commerce businesses, We help businesses streamline operations using n8n, AI agents, and data science to enhance efficiency and scalability.

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34