Repository navigation
Expand file tree
/
Copy pathtest-webhook.js
More file actions
63 lines (55 loc) · 1.97 KB
/
Copy pathtest-webhook.js
File metadata and controls
63 lines (55 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import fetch from 'node-fetch'; // Try utilizing node-fetch if available, or native fetch in newer node
// In a "type": "module" package, we can use top-level await or standard imports if node is recent.
// Since we don't know if node-fetch is installed, let's use standard http/https or native fetch.
// Given "type": "module" in package.json, native globalThis.fetch is likely available in Node 18+.
// If not, we'll use a simple https request.
const WEBHOOK_URL = "://primary-needlessly-dinosaur.ngrok-free.app/webhook-test/generer-cvhttps";
const sampleData = {
prenom: "Jean",
nom: "Dupont",
email: "jean.dupont@test.com",
template: "modern",
telephone: "0600000000",
localisation: "Paris",
poste: "Développeur Test",
resume: "Ceci est un test automatisé pour vérifier la connexion.",
experiences: [
{
poste: "Développeur Junior",
entreprise: "Tech Corp",
date_debut: "2020",
date_fin: "2022",
description: "Développement React."
}
],
education: [
{
ecole: "Université Test",
diplome: "Master Info",
annee_debut: "2018",
annee_fin: "2020"
}
],
competences: ["Javascript", "N8N", "React"],
langues: ["Français", "Anglais"],
projets: [],
loisirs: []
};
console.log("🚀 Envoi des données de test au webhook...");
console.log("URL:", WEBHOOK_URL);
try {
const response = await fetch(WEBHOOK_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(sampleData)
});
const text = await response.text();
console.log(`\n📬 Code statut: ${response.status}`);
console.log(`📄 Réponse du serveur:`);
console.log(text);
} catch (error) {
console.error("\n❌ Erreur lors de l'envoi:", error.message);
console.log("Vérifiez que l'URL est correcte et que le tunnel ngrok est actif.");
}