@messagebird/n8n-nodes-bird 0.16.0 → 0.16.1
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.
|
@@ -64,6 +64,9 @@ class BirdTrigger {
|
|
|
64
64
|
method: "GET",
|
|
65
65
|
path: `/v1/webhooks/${entry.id}`,
|
|
66
66
|
});
|
|
67
|
+
if (this.getMode() === "manual") {
|
|
68
|
+
this.getWorkflowStaticData("node").testWebhookUrl = url;
|
|
69
|
+
}
|
|
67
70
|
return true;
|
|
68
71
|
}
|
|
69
72
|
catch (error) {
|
|
@@ -89,6 +92,9 @@ class BirdTrigger {
|
|
|
89
92
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Bird did not return a webhook id and signing secret.");
|
|
90
93
|
}
|
|
91
94
|
endpoints(this)[url] = { id, secret };
|
|
95
|
+
if (this.getMode() === "manual") {
|
|
96
|
+
this.getWorkflowStaticData("node").testWebhookUrl = url;
|
|
97
|
+
}
|
|
92
98
|
return true;
|
|
93
99
|
},
|
|
94
100
|
async delete() {
|
|
@@ -109,13 +115,20 @@ class BirdTrigger {
|
|
|
109
115
|
}
|
|
110
116
|
}
|
|
111
117
|
delete store[url];
|
|
118
|
+
const data = this.getWorkflowStaticData("node");
|
|
119
|
+
if (data.testWebhookUrl === url)
|
|
120
|
+
delete data.testWebhookUrl;
|
|
112
121
|
return true;
|
|
113
122
|
},
|
|
114
123
|
},
|
|
115
124
|
};
|
|
116
125
|
async webhook() {
|
|
117
|
-
const
|
|
118
|
-
|
|
126
|
+
const data = this.getWorkflowStaticData("node");
|
|
127
|
+
// n8n's webhook context returns the production URL even for test deliveries.
|
|
128
|
+
const url = this.getMode() === "manual"
|
|
129
|
+
? data.testWebhookUrl
|
|
130
|
+
: this.getNodeWebhookUrl("default");
|
|
131
|
+
const entry = typeof url === "string" ? endpoints(this)[url] : undefined;
|
|
119
132
|
const headers = this.getHeaderData();
|
|
120
133
|
const request = this.getRequestObject();
|
|
121
134
|
const rawBody = request.rawBody;
|
|
@@ -138,10 +151,7 @@ class BirdTrigger {
|
|
|
138
151
|
});
|
|
139
152
|
return { noWebhookResponse: true };
|
|
140
153
|
}
|
|
141
|
-
//
|
|
142
|
-
// redelivery is ACKED — an unanswered request would hang until timeout
|
|
143
|
-
// and Bird would retry the same id forever.
|
|
144
|
-
const data = this.getWorkflowStaticData("node");
|
|
154
|
+
// TODO: Persist seenIds across live-webhook executions; n8n 2.22.6 drops these updates.
|
|
145
155
|
const seen = Array.isArray(data.seenIds) ? data.seenIds : [];
|
|
146
156
|
if (seen.includes(id)) {
|
|
147
157
|
this.getResponseObject().status(200).json({ received: true });
|
package/package.json
CHANGED