feat: Add run method to webhook triggers

This commit is contained in:
Faruk AYDIN
2023-10-07 18:34:53 +02:00
parent f79fc29203
commit 27a3edeb93
18 changed files with 89 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
import Crypto from 'crypto';
import isEmpty from 'lodash/isEmpty';
import defineTrigger from '../../../../helpers/define-trigger';
@@ -8,6 +9,21 @@ export default defineTrigger({
showWebhookUrl: true,
description: 'Triggers when the webhook receives a request.',
async run($) {
const dataItem = {
raw: {
headers: $.request.headers,
body: $.request.body,
query: $.request.query,
},
meta: {
internalId: Crypto.randomUUID(),
},
};
$.pushTriggerItem(dataItem);
},
async testRun($) {
const lastExecutionStep = await $.getLastExecutionStep();