génère le bulletin

    Shared 10/13/2025

    358 views

    Visual Workflow

    JSON Code

    {
      "meta": {
        "instanceId": ""
      },
      "nodes": [
        {
          "id": "80aeacea-d5a9-4fa5-a248-5b5aebca21b3",
          "name": "Respond to Webhook1",
          "type": "n8n-nodes-base.respondToWebhook",
          "position": [
            704,
            144
          ],
          "parameters": {
            "options": {},
            "respondWith": "text",
            "responseBody": "={{ $json.html }}"
          },
          "typeVersion": 1.4
        },
        {
          "id": "252b7636-c4c8-4247-9bf7-cc1fe13045d0",
          "name": "Sticky Note1",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            -240,
            48
          ],
          "parameters": {
            "width": 1264,
            "height": 288,
            "content": "## Génère html d'une carte"
          },
          "typeVersion": 1
        },
        {
          "id": "d2d6730a-26f5-4e98-b3c1-8c3094adee0b",
          "name": "Lit les infos adhesions",
          "type": "n8n-nodes-base.grist",
          "position": [
            160,
            144
          ],
          "parameters": {
            "docId": "",
            "limit": 1,
            "tableId": "Adhesions",
            "additionalOptions": {
              "filter": {
                "filterProperties": [
                  {
                    "field": "UUID",
                    "values": "={{ $json.params.uuid }}"
                  }
                ]
              }
            }
          },
          "credentials": {
            "gristApi": {
              "id": "cCPQ76XV1Oh6Ninh",
              "name": "Grist account"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "614ec801-bf80-4704-b595-0221ae782c4b",
          "name": "Génère la carte html",
          "type": "n8n-nodes-base.html",
          "position": [
            448,
            144
          ],
          "parameters": {
            "html": "<html>\n<head>\n  <style>\n    body {\n      font-family: Arial, sans-serif;\n      background: white;\n      padding: 20px;\n      display: flex;\n      flex-direction: column;\n      align-items: center;\n      color: black;\n    }\n\n    .card {\n      width: 350px;\n      border-radius: 16px;\n      padding: 20px;\n      background: white;\n      box-shadow: 0 4px 10px rgba(0,0,0,0.15);\n      position: relative;\n    }\n\n    .header {\n      text-align: center;\n      margin-bottom: 15px;\n    }\n\n    .header h2 {\n      margin: 0;\n      color: #2c7a7b;\n    }\n\n    .field {\n      margin: 6px 0;\n    }\n\n    .label {\n      font-weight: bold;\n      color: #333;\n    }\n\n    .value {\n      margin-left: 6px;\n    }\n\n    .status {\n      text-align: center;\n      margin-top: 10px;\n      font-weight: bold;\n      color: #2c5282;\n    }\n\n    .download-btn {\n      margin-top: 20px;\n      padding: 10px 16px;\n      border: none;\n      border-radius: 8px;\n      background: #2c7a7b;\n      color: white;\n      font-size: 14px;\n      cursor: pointer;\n      transition: background 0.2s ease;\n    }\n\n    .download-btn:hover {\n      background: #285e61;\n    }\n  </style>\n</head>\n<body>\n  <div id=\"card\" class=\"card\">\n    <div class=\"header\">\n      <h2>Association La super asso</h2>\n      <small>Carte d’adhésion</small>\n    </div>\n    <div class=\"field\"><span class=\"label\">Nom: </span><span id=\"nom\" class=\"value\">{{ $json.Nom }}</span></div>\n    <div class=\"field\"><span class=\"label\">Prénom: </span><span id=\"prenom\" class=\"value\">{{ $json.Prenom }}</span></div>\n    <div class=\"field\"><span class=\"label\">Mail: </span><span id=\"mail\" class=\"value\">{{ $json.email }}</span></div>\n    <div class=\"field\"><span class=\"label\">Adhésion du: </span><span id=\"date_debut\" class=\"value\">{{ $json.debut.toDateTime('s').format('dd-MM-yyyy') }}</span></div>\n    <div class=\"field\"><span class=\"label\">Au: </span><span id=\"date_fin\" class=\"value\">{{ $json.deadline.toDateTime('s').format('dd-MM-yyyy') }}</span></div>\n    <div class=\"status\" id=\"statut\">Statut: {{ $json.Statut }}</div>\n  </div>\n\n\n  </script>\n\n</body>\n</html>"
          },
          "typeVersion": 1.2
        },
        {
          "id": "107d9676-96a6-49f2-a8af-cd4bc271962d",
          "name": "Webhook1",
          "type": "n8n-nodes-base.webhook",
          "position": [
            -112,
            1056
          ],
          "webhookId": "3ad2b20c-a84a-45a3-9e5b-63651d98a161",
          "parameters": {
            "path": "3ad2b20c-a84a-45a3-9e5b-63651d98a161",
            "options": {},
            "httpMethod": "POST"
          },
          "typeVersion": 2.1
        },
        {
          "id": "cbfca6be-e90a-4d0c-9de7-375f664889ed",
          "name": "Sticky Note",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            -256,
            960
          ],
          "parameters": {
            "width": 816,
            "height": 320,
            "content": "## Envoi de l'email avec la carte d'adhésion\n"
          },
          "typeVersion": 1
        },
        {
          "id": "3faabd7c-c431-470e-a753-bf89bc86fa2e",
          "name": "Send Email1",
          "type": "n8n-nodes-base.emailSend",
          "position": [
            304,
            1056
          ],
          "webhookId": "7f21dbe7-d9b7-454b-9b15-6b952cd6504f",
          "parameters": {
            "html": "=Bonjour,\nveuillez trouver ci-joint votre carte d'adhésion",
            "options": {
              "attachments": "data",
              "appendAttribution": false
            },
            "subject": "🎉 Félicitations, voici votre carte d'adhésion",
            "toEmail": "={{ $('Webhook1').item.json.body[0].email }}",
            "fromEmail": "Le facteur <facteur@tierslieux.re>"
          },
          "credentials": {
            "smtp": {
              "id": "F1dXdmwXVG6YlHA9",
              "name": "SMTP Mailgun RTLx"
            }
          },
          "typeVersion": 2.1
        },
        {
          "id": "1cb4c8d7-3d4e-43e9-b825-8431aec2638f",
          "name": "Webhook2",
          "type": "n8n-nodes-base.webhook",
          "position": [
            -144,
            736
          ],
          "webhookId": "465fbb0b-02da-4cd7-bcb5-9e70d42993e7",
          "parameters": {
            "path": "465fbb0b-02da-4cd7-bcb5-9e70d42993e7",
            "options": {},
            "responseMode": "responseNode"
          },
          "typeVersion": 2.1
        },
        {
          "id": "fb9c6014-df5e-4cd2-a486-7fbb12ad8ccc",
          "name": "Lit les infos adhesions1",
          "type": "n8n-nodes-base.grist",
          "position": [
            48,
            736
          ],
          "parameters": {
            "docId": "",
            "limit": 1,
            "tableId": "Adhesions",
            "additionalOptions": {
              "sort": {
                "sortProperties": [
                  {
                    "field": "=id",
                    "direction": "desc"
                  }
                ]
              }
            }
          },
          "credentials": {
            "gristApi": {
              "id": "cCPQ76XV1Oh6Ninh",
              "name": "Grist account"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "1dfa1989-cf04-485d-95b1-2025645c6d5e",
          "name": "Sticky Note2",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            -240,
            672
          ],
          "parameters": {
            "width": 848,
            "height": 240,
            "content": "### Affichage pdf du dernier adhérent"
          },
          "typeVersion": 1
        },
        {
          "id": "fc1f25fb-5024-4982-bff0-16e8293ca0fe",
          "name": "Puppeteer",
          "type": "CUSTOM.puppeteer",
          "position": [
            80,
            464
          ],
          "parameters": {
            "url": "=https://n8n.tierslieux.re/webhook/cc74ebf3-43e3-460e-9d5b-449be9809216/{{ $json.params['uuid-adherent'] }}",
            "format": "A6",
            "margin": {},
            "options": {
              "fileName": "Carte-adhesion.pdf",
              "headless": true,
              "executablePath": "/usr/bin/chromium-browser",
              "launchArguments": {
                "args": [
                  {
                    "arg": "--no-sandbox"
                  }
                ]
              }
            },
            "operation": "getPDF",
            "preferCSSPageSize": false
          },
          "typeVersion": 1
        },
        {
          "id": "78dc4fd4-efef-4596-a370-9a0b14527016",
          "name": "Respond to Webhook",
          "type": "n8n-nodes-base.respondToWebhook",
          "position": [
            272,
            464
          ],
          "parameters": {
            "options": {
              "responseHeaders": {
                "entries": [
                  {
                    "name": "Content-Disposition",
                    "value": "attachment; filename=\"adhesion.pdf\""
                  }
                ]
              }
            },
            "respondWith": "binary",
            "responseDataSource": "set"
          },
          "typeVersion": 1.4
        },
        {
          "id": "349f5dc2-4fcf-4d4e-be3b-a9c94c64dba4",
          "name": "Webhook4",
          "type": "n8n-nodes-base.webhook",
          "position": [
            -112,
            144
          ],
          "webhookId": "cc74ebf3-43e3-460e-9d5b-449be9809216",
          "parameters": {
            "path": ":uuid",
            "options": {},
            "responseMode": "responseNode"
          },
          "typeVersion": 2.1
        },
        {
          "id": "ecc08853-6ec4-4766-b561-0d2c47da9168",
          "name": "Webhook",
          "type": "n8n-nodes-base.webhook",
          "position": [
            -144,
            464
          ],
          "webhookId": "f23c7287-9a8d-4a5c-8063-cc0d5a820721",
          "parameters": {
            "path": ":uuid-adherent",
            "options": {},
            "responseMode": "responseNode"
          },
          "typeVersion": 2.1
        },
        {
          "id": "399845e8-dbe8-4b17-865a-e421a1de7f25",
          "name": "Sticky Note3",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            -240,
            400
          ],
          "parameters": {
            "width": 848,
            "height": 240,
            "content": "## Affichage de la carte pdf d'un adhérent, passé dans l'url"
          },
          "typeVersion": 1
        },
        {
          "id": "e2c34506-4466-4eda-b3d9-151866c4bc45",
          "name": "Respond to Webhook2",
          "type": "n8n-nodes-base.respondToWebhook",
          "position": [
            256,
            736
          ],
          "parameters": {
            "options": {},
            "redirectURL": "=https://n8n.tierslieux.re/webhook/f23c7287-9a8d-4a5c-8063-cc0d5a820721/{{ $json.UUID }}",
            "respondWith": "redirect"
          },
          "typeVersion": 1.4
        },
        {
          "id": "4aa39a5d-093c-48f7-b93a-8f7765d361da",
          "name": "HTTP Request",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            96,
            1056
          ],
          "parameters": {
            "url": "=https://n8n.tierslieux.re/webhook/f23c7287-9a8d-4a5c-8063-cc0d5a820721/{{ $json.body[0].UUID }}",
            "options": {
              "response": {
                "response": {
                  "responseFormat": "file"
                }
              }
            }
          },
          "typeVersion": 4.2
        }
      ],
      "pinData": {
        "Webhook1": [
          {
            "body": [
              {
                "id": 4,
                "Nom": "rdtert",
                "UUID": "a725eb3a-317d-4fed-8f6b-3a9c0295c9b0",
                "debut": 1760313600,
                "email": "talaron@gmail.com",
                "Prenom": "prepre",
                "Statut": "Membre bienfaiteur",
                "deadline": 1791849600,
                "manualSort": 4,
                "Adhesion_valide": true,
                "Bulletin_d_adhesion": "https://n8n.tierslieux.re/webhook/9c551e1c-7e43-4eed-b764-d165cf3d58af/a725eb3a-317d-4fed-8f6b-3a9c0295c9b0"
              }
            ],
            "query": {},
            "params": {},
            "headers": {
              "host": "n8n.tierslieux.re",
              "accept": "*/*",
              "x-real-ip": "172.18.0.1",
              "user-agent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)",
              "content-type": "application/json",
              "content-length": "358",
              "accept-encoding": "gzip,deflate",
              "x-forwarded-for": "172.18.0.1",
              "x-forwarded-host": "n8n.tierslieux.re",
              "x-forwarded-port": "443",
              "x-forwarded-proto": "https",
              "x-forwarded-server": "79df39931f34"
            },
            "webhookUrl": "https://n8n.tierslieux.re/webhook/3ad2b20c-a84a-45a3-9e5b-63651d98a161",
            "executionMode": "production"
          }
        ]
      },
      "connections": {
        "Webhook": {
          "main": [
            [
              {
                "node": "Puppeteer",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Webhook1": {
          "main": [
            [
              {
                "node": "HTTP Request",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Webhook2": {
          "main": [
            [
              {
                "node": "Lit les infos adhesions1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Webhook4": {
          "main": [
            [
              {
                "node": "Lit les infos adhesions",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Puppeteer": {
          "main": [
            [
              {
                "node": "Respond to Webhook",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "HTTP Request": {
          "main": [
            [
              {
                "node": "Send Email1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Génère la carte html": {
          "main": [
            [
              {
                "node": "Respond to Webhook1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Lit les infos adhesions": {
          "main": [
            [
              {
                "node": "Génère la carte html",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Lit les infos adhesions1": {
          "main": [
            [
              {
                "node": "Respond to Webhook2",
                "type": "main",
                "index": 0
              }
            ]
          ]
        }
      }
    }