diff --git a/src/cdk/v2/destinations/webhook_v2/procWorkflow.yaml b/src/cdk/v2/destinations/http/procWorkflow.yaml similarity index 94% rename from src/cdk/v2/destinations/webhook_v2/procWorkflow.yaml rename to src/cdk/v2/destinations/http/procWorkflow.yaml index 873a9807ce..080dcdd80a 100644 --- a/src/cdk/v2/destinations/webhook_v2/procWorkflow.yaml +++ b/src/cdk/v2/destinations/http/procWorkflow.yaml @@ -3,7 +3,6 @@ bindings: path: ../../../../constants - path: ../../bindings/jsontemplate exportAll: true - - path: ../../../../v0/destinations/webhook/utils - name: getHashFromArray path: ../../../../v0/util - name: getIntegrationsObj @@ -19,7 +18,7 @@ bindings: steps: - name: validateInput template: | - $.assertConfig(.destination.Config.webhookUrl, "Webhook URL required. Aborting"); + $.assertConfig(.destination.Config.apiUrl, "API URL is required. Aborting"); $.assertConfig(!(.destination.Config.auth === "basicAuth" && !(.destination.Config.username)), "Username is required for Basic Authentication. Aborting"); $.assertConfig(!(.destination.Config.auth === "bearerTokenAuth" && !(.destination.Config.bearerToken)), "Token is required for Bearer Token Authentication. Aborting"); $.assertConfig(!(.destination.Config.auth === "apiKeyAuth" && !(.destination.Config.apiKeyName)), "API Key Name is required for API Key Authentication. Aborting"); @@ -48,7 +47,7 @@ steps: - name: deduceEndPoint template: | - $.context.endpoint = $.addPathParams(.message, .destination.Config.webhookUrl); + $.context.endpoint = $.addPathParams(.message, .destination.Config.apiUrl); - name: prepareBody template: | diff --git a/src/cdk/v2/destinations/webhook_v2/rtWorkflow.yaml b/src/cdk/v2/destinations/http/rtWorkflow.yaml similarity index 100% rename from src/cdk/v2/destinations/webhook_v2/rtWorkflow.yaml rename to src/cdk/v2/destinations/http/rtWorkflow.yaml diff --git a/src/cdk/v2/destinations/webhook_v2/utils.js b/src/cdk/v2/destinations/http/utils.js similarity index 93% rename from src/cdk/v2/destinations/webhook_v2/utils.js rename to src/cdk/v2/destinations/http/utils.js index 329c5fc053..355eb03487 100644 --- a/src/cdk/v2/destinations/webhook_v2/utils.js +++ b/src/cdk/v2/destinations/http/utils.js @@ -37,15 +37,15 @@ const getCustomMappings = (message, mapping) => { try { return applyCustomMappings(message, mapping); } catch (e) { - throw new ConfigurationError(`[Webhook]:: Error in custom mappings: ${e.message}`); + throw new ConfigurationError(`Error in custom mappings: ${e.message}`); } }; -const addPathParams = (message, webhookUrl) => { +const addPathParams = (message, apiUrl) => { try { - return applyJSONStringTemplate(message, `\`${webhookUrl}\``); + return applyJSONStringTemplate(message, `\`${apiUrl}\``); } catch (e) { - throw new ConfigurationError(`[Webhook]:: Error in url template: ${e.message}`); + throw new ConfigurationError(`Error in api url template: ${e.message}`); } }; diff --git a/test/integrations/destinations/webhook_v2/common.ts b/test/integrations/destinations/http/common.ts similarity index 93% rename from test/integrations/destinations/webhook_v2/common.ts rename to test/integrations/destinations/http/common.ts index dafc5853d5..f0c8bc8a33 100644 --- a/test/integrations/destinations/webhook_v2/common.ts +++ b/test/integrations/destinations/http/common.ts @@ -1,12 +1,12 @@ import { Destination } from '../../../../src/types'; -const destType = 'webhook_v2'; -const destTypeInUpperCase = 'WEBHOOK_V2'; -const displayName = 'Webhook V2'; +const destType = 'http'; +const destTypeInUpperCase = 'HTTP'; +const displayName = 'HTTP'; const destinations: Destination[] = [ { Config: { - webhookUrl: 'http://abc.com/contacts', + apiUrl: 'http://abc.com/contacts', auth: 'noAuth', method: 'POST', format: 'JSON', @@ -41,7 +41,7 @@ const destinations: Destination[] = [ }, { Config: { - webhookUrl: 'http://abc.com/contacts', + apiUrl: 'http://abc.com/contacts', auth: 'basicAuth', username: 'test-user', password: '', @@ -92,7 +92,7 @@ const destinations: Destination[] = [ }, { Config: { - webhookUrl: 'http://abc.com/contacts/{{$.traits.email}}/', + apiUrl: 'http://abc.com/contacts/{{$.traits.email}}/', auth: 'apiKeyAuth', apiKeyName: 'x-api-key', apiKeyValue: 'test-api-key', @@ -114,7 +114,7 @@ const destinations: Destination[] = [ }, { Config: { - webhookUrl: 'http://abc.com/contacts/{{$.traits.email}}/', + apiUrl: 'http://abc.com/contacts/{{$.traits.email}}/', auth: 'apiKeyAuth', apiKeyName: 'x-api-key', apiKeyValue: 'test-api-key', @@ -136,7 +136,7 @@ const destinations: Destination[] = [ }, { Config: { - webhookUrl: 'http://abc.com/events', + apiUrl: 'http://abc.com/events', auth: 'bearerTokenAuth', bearerToken: 'test-token', method: 'POST', @@ -196,7 +196,7 @@ const destinations: Destination[] = [ }, { Config: { - webhookUrl: 'http://abc.com/events', + apiUrl: 'http://abc.com/events', auth: 'noAuth', method: 'POST', format: 'JSON', @@ -249,7 +249,7 @@ const destinations: Destination[] = [ }, { Config: { - webhookUrl: 'http://abc.com/contacts/{{$.traits.phone}}', + apiUrl: 'http://abc.com/contacts/{{$.traits.phone}}', auth: 'noAuth', method: 'POST', format: 'JSON', diff --git a/test/integrations/destinations/webhook_v2/processor/configuration.ts b/test/integrations/destinations/http/processor/configuration.ts similarity index 93% rename from test/integrations/destinations/webhook_v2/processor/configuration.ts rename to test/integrations/destinations/http/processor/configuration.ts index 702c20a6fb..b493a236ee 100644 --- a/test/integrations/destinations/webhook_v2/processor/configuration.ts +++ b/test/integrations/destinations/http/processor/configuration.ts @@ -4,7 +4,7 @@ import { destType, destinations, properties, traits } from '../common'; export const configuration: ProcessorTestData[] = [ { - id: 'webhook_v2-configuration-test-1', + id: 'http-configuration-test-1', name: destType, description: 'Identify call with properties mapping', scenario: 'Business', @@ -36,7 +36,7 @@ export const configuration: ProcessorTestData[] = [ output: transformResultBuilder({ method: 'POST', userId: '', - endpoint: destinations[0].Config.webhookUrl, + endpoint: destinations[0].Config.apiUrl, JSON: { contacts: { first_name: 'John', @@ -55,7 +55,7 @@ export const configuration: ProcessorTestData[] = [ }, }, { - id: 'webhook_v2-configuration-test-2', + id: 'http-configuration-test-2', name: destType, description: 'Identify call with api key auth, delete method and path params', scenario: 'Business', @@ -100,7 +100,7 @@ export const configuration: ProcessorTestData[] = [ }, }, { - id: 'webhook_v2-configuration-test-3', + id: 'http-configuration-test-3', name: destType, description: 'Track call with basic auth, get method, headers and query params mapping', scenario: 'Business', @@ -132,7 +132,7 @@ export const configuration: ProcessorTestData[] = [ output: transformResultBuilder({ method: 'GET', userId: '', - endpoint: destinations[1].Config.webhookUrl, + endpoint: destinations[1].Config.apiUrl, headers: { Authorization: 'Basic dGVzdC11c2VyOg==', h1: 'val1', @@ -151,7 +151,7 @@ export const configuration: ProcessorTestData[] = [ }, }, { - id: 'webhook_v2-configuration-test-4', + id: 'http-configuration-test-4', name: destType, description: 'Track call with bearer token, xml format, post method, additional headers and properties mapping', @@ -185,7 +185,7 @@ export const configuration: ProcessorTestData[] = [ output: transformResultBuilder({ method: 'POST', userId: '', - endpoint: destinations[4].Config.webhookUrl, + endpoint: destinations[4].Config.apiUrl, headers: { Authorization: 'Bearer test-token', h1: 'val1', diff --git a/test/integrations/destinations/webhook_v2/processor/data.ts b/test/integrations/destinations/http/processor/data.ts similarity index 100% rename from test/integrations/destinations/webhook_v2/processor/data.ts rename to test/integrations/destinations/http/processor/data.ts diff --git a/test/integrations/destinations/webhook_v2/router/data.ts b/test/integrations/destinations/http/router/data.ts similarity index 97% rename from test/integrations/destinations/webhook_v2/router/data.ts rename to test/integrations/destinations/http/router/data.ts index 34f16f211f..ea14ec7341 100644 --- a/test/integrations/destinations/webhook_v2/router/data.ts +++ b/test/integrations/destinations/http/router/data.ts @@ -1,11 +1,5 @@ import { generateMetadata } from '../../../testUtils'; -import { - destType, - destinations, - traits, - properties, - RouterInstrumentationErrorStatTags, -} from '../common'; +import { destType, destinations, traits, properties } from '../common'; const routerRequest1 = { input: [ @@ -164,7 +158,7 @@ const routerRequest4 = { export const data = [ { - id: 'webhook_v2-router-test-1', + id: 'http-router-test-1', name: destType, description: 'Batch multiple GET requests in a single batch with given batch size', scenario: 'Framework', @@ -212,7 +206,7 @@ export const data = [ }, }, { - id: 'webhook_v2-router-test-2', + id: 'http-router-test-2', name: destType, description: 'Batch multiple GET requests in multiple batches when number of requests are greater then given batch size', @@ -334,7 +328,7 @@ export const data = [ }, }, { - id: 'webhook_v2-router-test-3', + id: 'http-router-test-3', name: destType, description: 'Batch multiple POST requests with properties mappings', scenario: 'Framework', @@ -389,9 +383,9 @@ export const data = [ }, }, { - id: 'webhook_v2-router-test-4', + id: 'http-router-test-4', name: destType, - description: 'Batch multiple requests based on webhook url and headers', + description: 'Batch multiple requests based on api url and headers', scenario: 'Framework', successCriteria: 'All events should be transformed successfully and status code should be 200', feature: 'router',