Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

triggerable webhook data

Fendy Heryanto2a1eaa2575ee
diff --git a/packages/nocodb-sdk/src/lib/enums.ts b/packages/nocodb-sdk/src/lib/enums.ts
index fbca300c84..a88b1bad61 100644
--- a/packages/nocodb-sdk/src/lib/enums.ts
+++ b/packages/nocodb-sdk/src/lib/enums.ts
@@ -515,7 +515,7 @@ export enum HookOperationCode {
}
export enum WebhookActions {
- CREATE = 'create',
+ INSERT = 'insert',
UPDATE = 'update',
DELETE = 'delete',
}
diff --git a/packages/nocodb/src/helpers/webhookHelpers.ts b/packages/nocodb/src/helpers/webhookHelpers.ts
index 657e7d8dc1..0b2bd5f126 100644
--- a/packages/nocodb/src/helpers/webhookHelpers.ts
+++ b/packages/nocodb/src/helpers/webhookHelpers.ts
@@ -407,9 +407,10 @@ export function constructWebHookData(
newData: Record<string, unknown>,
user = null,
) {
+ // TODO: construct webhook view data
if (['v2', 'v3'].includes(hook.version)) {
// extend in the future - currently only support records
- const scope = 'records';
+ const scope = ['after', 'manual'].includes(hook.event) ? 'records.' : '';
const isBulkInsert =
hook.version === 'v2' && (hook.operation as any) === 'bulkInsert';
@@ -417,7 +418,7 @@ export function constructWebHookData(
const includeUser = parseMetaProp(hook, 'notification')?.include_user;
return {
- type: `${scope}.${hook.event}.${hook.operation}`,
+ type: `${scope}${hook.event}.${hook.operation}`,
id: uuidv4(),
...(includeUser && isEE && user
? { user: sanitizeUserForHook(user) }
diff --git a/packages/nocodb/src/utils/view-webhook-manager.ts b/packages/nocodb/src/utils/view-webhook-manager.ts
index f1c3325145..67772101ed 100644
--- a/packages/nocodb/src/utils/view-webhook-manager.ts
+++ b/packages/nocodb/src/utils/view-webhook-manager.ts
@@ -60,7 +60,7 @@ export class ViewWebhookManagerBuilder {
);
}
return new ViewWebhookManager(this.context, {
- action: WebhookActions.CREATE,
+ action: WebhookActions.INSERT,
model: this.model!,
modelId: this.modelId!,
modelWebhookManager: this.modelWebhookManager,