Génération de factures pour les clients avec Jotform, Xero et Gmail

Intermédiaire

Ceci est uncontenant 13 nœuds.Utilise principalement des nœuds comme Code, Xero, Gmail, Webhook, Agent. Générer des factures professionnelles avec Jotform, Xero et un système d'e-mail piloté par GPT

Prérequis
  • Compte Google et informations d'identification Gmail API
  • Point de terminaison HTTP Webhook (généré automatiquement par n8n)
  • Clé API OpenAI

Catégorie

-
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
{
  "id": "UVDQqxGZJ1zaxyNj",
  "meta": {
    "instanceId": "3549451ca835035557d5dc1c3d9e6ba924e7314534a74c901f66b91f9ef6023e",
    "templateCredsSetupCompleted": true
  },
  "name": "Generate Invoices for Customers with Jotform, Xero and Gmail",
  "tags": [],
  "nodes": [
    {
      "id": "065aeee4-b7de-4e08-a95e-1c4846861411",
      "name": "Recevoir la soumission du formulaire",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -464,
        0
      ],
      "webhookId": "bf87ee72-aecf-44e5-a466-3d0144da2221",
      "parameters": {
        "path": "bf87ee72-aecf-44e5-a466-3d0144da2221",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    },
    {
      "id": "4b4284d5-10b9-439e-99f0-08f9c48fc683",
      "name": "Note adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 320,
        "content": "## Receive Submission\nReceives the product/service form submission from Jotform"
      },
      "typeVersion": 1
    },
    {
      "id": "33e3c8d0-02d4-4887-973a-106988ebe9d4",
      "name": "Note adhésive 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        64,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 288,
        "height": 320,
        "content": "## Create/Update Contact\nCreates or updates the contact"
      },
      "typeVersion": 1
    },
    {
      "id": "dc1c4f42-d6c8-455b-9c2b-4004a990eb21",
      "name": "Note adhésive 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 320,
        "content": "## Create The Invoice\nCreates a new invoice for that contact"
      },
      "typeVersion": 1
    },
    {
      "id": "aaf471ff-be4d-4bc7-9132-c45a01bdd5d1",
      "name": "Note adhésive 7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1328,
        -400
      ],
      "parameters": {
        "width": 736,
        "height": 832,
        "content": "## Generate Invoices for Customers with Jotform, Xero and Gmail\nThis workflow automates the entire process of receiving a product/service order, checking or creating a customer in **Xero**, generating an invoice, and emailing it — all triggered by a form submission (via **Jotform**).\n\n## How It Works\n### 1- Receive Submission\n* Triggered when a user submits a form.\n* Collects data like customer details, selected product/service, etc.\n\n### 2- Create/Update The Customer\n* Creates/Updates the customer.\n\n### 3- Create The Invoice\n* Generates a new invoice for the customer using the item selected.\n\n### 4- Send The Invoice\n* Automatically sends the invoice via email to the customer.\n\n## Who Can Benefit from This Workflow?\n* **Freelancers**\n* **Service Providers**\n* **Consultants & Coaches**\n* **Small Businesses**\n* **E-commerce or Custom Product Sellers**\n\n## Requirements\n- Jotform webhook setup, more info [here](https://www.jotform.com/help/245-how-to-setup-a-webhook-with-jotform/)\n- Xero credentials, more info [here](https://docs.n8n.io/integrations/builtin/credentials/xero)\n- Make sure that products/services values in Jotform are exactly the same as your item `Code` in your Xero account\n- Email setup, update email node (`Send email`), more info about Gmail setup [here](https://docs.n8n.io/integrations/builtin/credentials/google)\n- LLM model credentials"
      },
      "typeVersion": 1
    },
    {
      "id": "c391a307-3bef-45c9-8310-8110e7058a37",
      "name": "Note adhésive 8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 320,
        "content": "## Format Data\nFormats the data thus making it easier to be used in other nodes"
      },
      "typeVersion": 1
    },
    {
      "id": "7fac0a20-8cf3-4dfc-b65d-9b59444f1c61",
      "name": "Formater les données",
      "type": "n8n-nodes-base.code",
      "position": [
        -160,
        0
      ],
      "parameters": {
        "jsCode": "function extractAddressData(text) {\n  const regex = /Street Address:\\s*([^<]+)<br>Street Address Line 2:\\s*([^<]+)<br>City:\\s*([^<]+)<br>State \\/ Province:\\s*([^<]+)<br>Postal \\/ Zip Code:\\s*([^<]+)<br>Country:\\s*([^<]+)<br>/;\n  const matches = text.match(regex);\n  \n  if (matches) {\n    return {\n      line1: matches[1].trim(),\n      line2: matches[2].trim(),\n      city: matches[3].trim(),\n      stateProvince: matches[4].trim(),\n      postalZipCode: matches[5].trim(),\n      country: matches[6].trim()\n    };\n  }\n  \n  return {\n    line1: null,\n    line2: null,\n    city: null,\n    stateProvince: null,\n    postalZipCode: null,\n    country: null\n  }\n}\n\nreturn {\n  address: extractAddressData($input.first().json.body.billingAddress),\n  customer: {\n    name: $input.first().json.body.name,\n    email: $input.first().json.body.email,\n    phone: $input.first().json.body.phone\n  },\n  item: {\n    name: $input.first().json.body.itemName\n  }\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "28d16066-551a-4205-b24d-4759d02d881e",
      "name": "Créer/Mettre à jour le contact",
      "type": "n8n-nodes-base.xero",
      "position": [
        160,
        0
      ],
      "parameters": {
        "name": "={{ $json.customer.name }}",
        "resource": "contact",
        "organizationId": "bc9a44a6-eb14-4f81-b24c-ca676c506446",
        "additionalFields": {
          "phonesUi": {
            "phonesValues": [
              {
                "phoneType": "MOBILE",
                "phoneNumber": "={{ $json.customer.phone }}"
              }
            ]
          },
          "addressesUi": {
            "addressesValues": [
              {
                "city": "={{ $json.address.city }}",
                "type": "STREET",
                "line1": "={{ $json.address.line1 }}",
                "line2": "={{ $json.address.line2 }}",
                "region": "={{ $json.address.stateProvince }}",
                "country": "={{ $json.address.country }}",
                "postalCode": "={{ $json.address.postalZipCode }}"
              }
            ]
          },
          "emailAddress": "={{ $json.customer.email }}"
        }
      },
      "credentials": {
        "xeroOAuth2Api": {
          "id": "HZnbTfrr5leqrLUQ",
          "name": "Xero account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "46594f4d-9682-4298-a366-40bcb54c9ccb",
      "name": "Créer la facture",
      "type": "n8n-nodes-base.xero",
      "position": [
        480,
        0
      ],
      "parameters": {
        "type": "ACCREC",
        "contactId": "={{ $json.ContactID }}",
        "lineItemsUi": {
          "lineItemsValues": [
            {
              "taxType": "INPUT",
              "itemCode": "={{ $('Format data').item.json.item.name }}",
              "unitAmount": "10",
              "accountCode": "200"
            }
          ]
        },
        "organizationId": "bc9a44a6-eb14-4f81-b24c-ca676c506446",
        "additionalFields": {}
      },
      "credentials": {
        "xeroOAuth2Api": {
          "id": "HZnbTfrr5leqrLUQ",
          "name": "Xero account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3b291d2e-a98a-474e-aaf2-8edd4bd734f1",
      "name": "Agent IA",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        816,
        -64
      ],
      "parameters": {
        "text": "={{ $json }}",
        "options": {
          "systemMessage": "=You are an AI assistant that generates a professional invoice email that you get from an Xero response (newly created invoice), so you will recive an Xero invoice response and thus your job is to create a professional html email content because this html email content will be sent to the customer."
        },
        "promptType": "define"
      },
      "executeOnce": false,
      "typeVersion": 2.2
    },
    {
      "id": "d770459b-7a80-4abb-8609-aece00840acb",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        816,
        144
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "ns8LVe1zpSS3Kw9p",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ce21e6a5-1657-49ec-979e-d14c7f578364",
      "name": "Note adhésive 19",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        -192
      ],
      "parameters": {
        "color": 7,
        "width": 592,
        "height": 480,
        "content": "## Send The Invoice\nSends the newly created invoice for that customer(via email)"
      },
      "typeVersion": 1
    },
    {
      "id": "d661fc32-c68c-463d-b815-2f342a3ac011",
      "name": "Envoyer l'e-mail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1088,
        -64
      ],
      "webhookId": "34d9e2cd-ada9-43de-b476-36ae61b9ff32",
      "parameters": {
        "sendTo": "={{ $('Create the invoice').item.json.Contact.EmailAddress }}",
        "message": "={{ $json.output }}",
        "options": {},
        "subject": "New Invoice"
      },
      "typeVersion": 2.1
    }
  ],
  "active": false,
  "pinData": {
    "Receive form submission": [
      {
        "json": {
          "body": {
            "name": "Adrian Mathews",
            "email": "yoled82772@elygifts.com",
            "phone": "(116) 777-9916",
            "itemName": "Design",
            "billingAddress": "Street Address: Nulla quia debitis est quam facilis amet enim cupidatat officia autem consequatur qui quis dolorem<br>Street Address Line 2: Possimus perferendis ad veritatis quia animi<br>City: Voluptatibus eveniet harum unde dolor doloremque cumque dol<br>State / Province: Reprehenderit rerum voluptas magni ut minim ad deleniti eni<br>Postal / Zip Code: 17167<br>Country: Seychelles<br>"
          }
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d514ba5d-30a5-4cfb-b09f-b1a611151c1f",
  "connections": {
    "3b291d2e-a98a-474e-aaf2-8edd4bd734f1": {
      "main": [
        [
          {
            "node": "d661fc32-c68c-463d-b815-2f342a3ac011",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7fac0a20-8cf3-4dfc-b65d-9b59444f1c61": {
      "main": [
        [
          {
            "node": "28d16066-551a-4205-b24d-4759d02d881e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d770459b-7a80-4abb-8609-aece00840acb": {
      "ai_languageModel": [
        [
          {
            "node": "3b291d2e-a98a-474e-aaf2-8edd4bd734f1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "46594f4d-9682-4298-a366-40bcb54c9ccb": {
      "main": [
        [
          {
            "node": "3b291d2e-a98a-474e-aaf2-8edd4bd734f1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "065aeee4-b7de-4e08-a95e-1c4846861411": {
      "main": [
        [
          {
            "node": "7fac0a20-8cf3-4dfc-b65d-9b59444f1c61",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "28d16066-551a-4205-b24d-4759d02d881e": {
      "main": [
        [
          {
            "node": "46594f4d-9682-4298-a366-40bcb54c9ccb",
            "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é ?

Intermédiaire

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é
Intermédiaire
Nombre de nœuds13
Catégorie-
Types de nœuds7
Description de la difficulté

Adapté aux utilisateurs expérimentés, avec des workflows de complexité moyenne contenant 6-15 nœuds

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34