n8n-nodes-notifzig 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
-
#
|
|
1
|
+
# n8n-nodes-notifzig
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Node n8n pour envoyer des notifications sur ton téléphone avec Notifzig : logo au choix, catégories et historique filtrable.
|
|
4
|
+
|
|
5
|
+
## Avant de commencer
|
|
6
|
+
|
|
7
|
+
Il te faut un compte Notifzig : l'appli s'utilise sur invitation. Une fois connecté, crée une clé dans **Réglages → Clés API**. Elle n'est affichée qu'une seule fois, et tout ce qui est envoyé avec elle arrive sur tes appareils.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Dans n8n : **Settings → Community Nodes → Install**, puis saisis `n8n-nodes-notifzig`.
|
|
12
|
+
|
|
13
|
+
## Configuration
|
|
14
|
+
|
|
15
|
+
1. Ajoute le node **Notifzig** à un workflow.
|
|
16
|
+
2. Crée un identifiant **Notifzig API** et colle ta clé.
|
|
17
|
+
3. Laisse l'adresse du serveur telle quelle, sauf si tu héberges ta propre passerelle.
|
|
18
|
+
|
|
19
|
+
## Champs
|
|
20
|
+
|
|
21
|
+
| Champ | Rôle |
|
|
22
|
+
|---|---|
|
|
23
|
+
| **Catégorie** | Erreurs, Paiements, Bonnes nouvelles, Général, ou un nom libre (créé automatiquement) |
|
|
24
|
+
| **Titre** et **Message** | Le contenu de la notification |
|
|
25
|
+
| **Source** | Nom utilisé pour filtrer l'historique ; par défaut, le nom du workflow |
|
|
26
|
+
| **Logo** | Adresse `https` d'une image PNG ou JPEG, carrée de préférence |
|
|
27
|
+
| **Lien** | Adresse ouverte depuis la page de détail de la notification |
|
|
28
|
+
| **Priorité** | `Urgente` passe les modes Concentration sur iPhone, mais pas le mode silencieux |
|
|
29
|
+
| **Sonnerie** | Remplace la sonnerie choisie pour cette catégorie dans l'appli |
|
|
30
|
+
|
|
31
|
+
## Être prévenu quand un workflow échoue
|
|
32
|
+
|
|
33
|
+
1. Crée un workflow avec un **Error Trigger** suivi du node **Notifzig**.
|
|
34
|
+
2. Dans le titre, mets par exemple `{{ $json.workflow.name }} en échec`, et dans le message `{{ $json.execution.error.message }}`.
|
|
35
|
+
3. Dans le lien, mets `{{ $json.execution.url }}`.
|
|
36
|
+
4. Dans les réglages de chaque workflow à surveiller, choisis ce workflow comme **Error Workflow**.
|
|
37
|
+
|
|
38
|
+
## Licence
|
|
39
|
+
|
|
40
|
+
MIT
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotifzigApi = void 0;
|
|
4
|
+
class NotifzigApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'notifzigApi';
|
|
7
|
+
this.displayName = 'Notifzig API';
|
|
8
|
+
this.documentationUrl = 'https://www.npmjs.com/package/n8n-nodes-notifzig';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'Clé API',
|
|
12
|
+
name: 'cle',
|
|
13
|
+
type: 'string',
|
|
14
|
+
typeOptions: { password: true },
|
|
15
|
+
default: '',
|
|
16
|
+
required: true,
|
|
17
|
+
description: "À créer dans l'appli Notifzig, écran Clés API. Elle choisit les téléphones qui reçoivent la notification.",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Adresse du serveur',
|
|
21
|
+
name: 'serveur',
|
|
22
|
+
type: 'string',
|
|
23
|
+
default: 'https://notifzig.subzig.fr',
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
this.authenticate = {
|
|
28
|
+
type: 'generic',
|
|
29
|
+
properties: {
|
|
30
|
+
headers: { Authorization: '=Bearer {{$credentials.cle}}' },
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
this.test = {
|
|
34
|
+
request: { baseURL: '={{$credentials.serveur}}', url: '/v1/cle' },
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.NotifzigApi = NotifzigApi;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Notifzig = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
class Notifzig {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.description = {
|
|
8
|
+
displayName: 'Notifzig',
|
|
9
|
+
name: 'notifzig',
|
|
10
|
+
icon: 'file:notifzig.svg',
|
|
11
|
+
group: ['output'],
|
|
12
|
+
version: 1,
|
|
13
|
+
subtitle: '={{$parameter["categorie"]}}',
|
|
14
|
+
description: 'Envoie une notification sur ton téléphone, avec logo, catégorie et historique',
|
|
15
|
+
defaults: { name: 'Notifzig' },
|
|
16
|
+
inputs: ['main'],
|
|
17
|
+
outputs: ['main'],
|
|
18
|
+
usableAsTool: true,
|
|
19
|
+
credentials: [{ name: 'notifzigApi', required: true }],
|
|
20
|
+
properties: [
|
|
21
|
+
{
|
|
22
|
+
displayName: "Pour être prévenu de l'échec d'un workflow, place ce node après un « Error Trigger », puis choisis ce workflow comme « Error Workflow » dans les réglages du workflow à surveiller.",
|
|
23
|
+
name: 'astuce',
|
|
24
|
+
type: 'notice',
|
|
25
|
+
default: '',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
displayName: 'Catégorie',
|
|
29
|
+
name: 'categorie',
|
|
30
|
+
type: 'options',
|
|
31
|
+
default: 'erreurs',
|
|
32
|
+
options: [
|
|
33
|
+
{ name: 'Erreurs', value: 'erreurs' },
|
|
34
|
+
{ name: 'Paiements', value: 'paiements' },
|
|
35
|
+
{ name: 'Bonnes Nouvelles', value: 'bonnes-nouvelles' },
|
|
36
|
+
{ name: 'Général', value: 'general' },
|
|
37
|
+
{ name: 'Autre (à préciser)', value: '__autre' },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
displayName: 'Nom De La Catégorie',
|
|
42
|
+
name: 'categorieLibre',
|
|
43
|
+
type: 'string',
|
|
44
|
+
default: '',
|
|
45
|
+
required: true,
|
|
46
|
+
placeholder: 'Clients VIP',
|
|
47
|
+
description: "Créée automatiquement dans l'appli si elle n'existe pas encore",
|
|
48
|
+
displayOptions: { show: { categorie: ['__autre'] } },
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
displayName: 'Titre',
|
|
52
|
+
name: 'titre',
|
|
53
|
+
type: 'string',
|
|
54
|
+
default: '',
|
|
55
|
+
required: true,
|
|
56
|
+
placeholder: 'Workflow Factures en échec',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
displayName: 'Message',
|
|
60
|
+
name: 'message',
|
|
61
|
+
type: 'string',
|
|
62
|
+
typeOptions: { rows: 3 },
|
|
63
|
+
default: '',
|
|
64
|
+
required: true,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
displayName: 'Options',
|
|
68
|
+
name: 'options',
|
|
69
|
+
type: 'collection',
|
|
70
|
+
placeholder: 'Ajouter une option',
|
|
71
|
+
default: {},
|
|
72
|
+
options: [
|
|
73
|
+
{
|
|
74
|
+
displayName: 'Lien',
|
|
75
|
+
name: 'lien',
|
|
76
|
+
type: 'string',
|
|
77
|
+
default: '',
|
|
78
|
+
description: "Adresse ouverte depuis la notification (par exemple l'exécution en erreur)",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
displayName: 'Logo',
|
|
82
|
+
name: 'logo',
|
|
83
|
+
type: 'string',
|
|
84
|
+
default: '',
|
|
85
|
+
placeholder: 'https://exemple.fr/logo.png',
|
|
86
|
+
description: 'Adresse https d\'une image PNG ou JPEG, carrée de préférence',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
displayName: 'Priorité',
|
|
90
|
+
name: 'priorite',
|
|
91
|
+
type: 'options',
|
|
92
|
+
default: 'normale',
|
|
93
|
+
options: [
|
|
94
|
+
{ name: 'Normale', value: 'normale' },
|
|
95
|
+
{ name: 'Urgente', value: 'urgente', description: 'Sur iPhone, passe les modes Concentration' },
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
displayName: 'Sonnerie',
|
|
100
|
+
name: 'son',
|
|
101
|
+
type: 'options',
|
|
102
|
+
default: 'alerte',
|
|
103
|
+
description: "Remplace la sonnerie choisie pour cette catégorie dans l'appli",
|
|
104
|
+
options: [
|
|
105
|
+
{ name: 'Alerte', value: 'alerte' },
|
|
106
|
+
{ name: 'Caisse', value: 'caisse' },
|
|
107
|
+
{ name: 'Carillon', value: 'carillon' },
|
|
108
|
+
{ name: 'Discret', value: 'discret' },
|
|
109
|
+
{ name: 'Sirène', value: 'sirene' },
|
|
110
|
+
{ name: 'Son Du Téléphone', value: 'defaut' },
|
|
111
|
+
{ name: 'Succès', value: 'succes' },
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
displayName: 'Source',
|
|
116
|
+
name: 'source',
|
|
117
|
+
type: 'string',
|
|
118
|
+
default: '={{ $workflow.name }}',
|
|
119
|
+
description: "Nom utilisé pour filtrer l'historique",
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
async execute() {
|
|
127
|
+
const elements = this.getInputData();
|
|
128
|
+
const resultats = [];
|
|
129
|
+
const { serveur } = await this.getCredentials('notifzigApi');
|
|
130
|
+
for (let i = 0; i < elements.length; i++) {
|
|
131
|
+
try {
|
|
132
|
+
const choix = this.getNodeParameter('categorie', i);
|
|
133
|
+
const options = this.getNodeParameter('options', i, {});
|
|
134
|
+
const corps = {
|
|
135
|
+
categorie: choix === '__autre' ? this.getNodeParameter('categorieLibre', i) : choix,
|
|
136
|
+
titre: this.getNodeParameter('titre', i),
|
|
137
|
+
message: this.getNodeParameter('message', i),
|
|
138
|
+
};
|
|
139
|
+
for (const champ of ['source', 'logo', 'lien', 'priorite', 'son']) {
|
|
140
|
+
if (options[champ])
|
|
141
|
+
corps[champ] = options[champ];
|
|
142
|
+
}
|
|
143
|
+
const reponse = await this.helpers.httpRequestWithAuthentication.call(this, 'notifzigApi', {
|
|
144
|
+
method: 'POST',
|
|
145
|
+
baseURL: serveur.replace(/\/+$/, ''),
|
|
146
|
+
url: '/v1/notifications',
|
|
147
|
+
body: corps,
|
|
148
|
+
json: true,
|
|
149
|
+
});
|
|
150
|
+
resultats.push({ json: reponse, pairedItem: { item: i } });
|
|
151
|
+
}
|
|
152
|
+
catch (erreur) {
|
|
153
|
+
if (this.continueOnFail()) {
|
|
154
|
+
resultats.push({ json: { erreur: erreur.message }, pairedItem: { item: i } });
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
if (erreur instanceof n8n_workflow_1.NodeOperationError)
|
|
158
|
+
throw erreur;
|
|
159
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), erreur, { itemIndex: i });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return [resultats];
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
exports.Notifzig = Notifzig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" rx="14" fill="#E5484D"/><path fill="#fff" d="M32 12a5 5 0 0 0-5 5v1.4C20.600 20.500 17 26.300 17 33v8l-4 5v2h38v-2l-4-5v-8c0-6.700-3.600-12.500-10-14.600V17a5 5 0 0 0-5-5zm-6 39a6 6 0 0 0 12 0z"/></svg>
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-notifzig",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Envoie des notifications sur ton téléphone avec Notifzig : logo personnalisé, catégories et historique.",
|
|
5
|
+
"keywords": ["n8n-community-node-package", "notifzig", "notification", "push"],
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "index.js",
|
|
8
|
+
"files": ["dist"],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc && node -e \"require('fs').copyFileSync('nodes/Notifzig/notifzig.svg','dist/nodes/Notifzig/notifzig.svg')\"",
|
|
11
|
+
"test": "npm run build && node --test"
|
|
12
|
+
},
|
|
13
|
+
"n8n": {
|
|
14
|
+
"n8nNodesApiVersion": 1,
|
|
15
|
+
"credentials": ["dist/credentials/NotifzigApi.credentials.js"],
|
|
16
|
+
"nodes": ["dist/nodes/Notifzig/Notifzig.node.js"]
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"n8n-workflow": "*",
|
|
20
|
+
"typescript": "^5.6.0"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"n8n-workflow": "*"
|
|
24
|
+
}
|
|
25
|
+
}
|