diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c63fb4310..c860747b6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [1.79.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.78.0...v1.79.0) (2024-09-20) + + +### Features + +* add support for vdm next to fb custom audiences ([#3729](https://github.com/rudderlabs/rudder-transformer/issues/3729)) ([f33f525](https://github.com/rudderlabs/rudder-transformer/commit/f33f52503679be9271751aaa2fdca0661fed62e9)) + + +### Bug Fixes + +* use destination definition name in place of string for custom object ([#3746](https://github.com/rudderlabs/rudder-transformer/issues/3746)) ([27040b0](https://github.com/rudderlabs/rudder-transformer/commit/27040b06276c2bd1c1a6bd535172b50848a97261)) + ## [1.78.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.77.1...v1.78.0) (2024-09-16) diff --git a/package-lock.json b/package-lock.json index fadfe7df1b..98bc41379e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rudder-transformer", - "version": "1.78.0", + "version": "1.79.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rudder-transformer", - "version": "1.78.0", + "version": "1.79.0", "license": "ISC", "dependencies": { "@amplitude/ua-parser-js": "0.7.24", diff --git a/package.json b/package.json index da4891e849..c598db805c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rudder-transformer", - "version": "1.78.0", + "version": "1.79.0", "description": "", "homepage": "https://github.com/rudderlabs/rudder-transformer#readme", "bugs": { diff --git a/src/v0/destinations/salesforce/transform.js b/src/v0/destinations/salesforce/transform.js index 9b7123c207..1dde1ec65a 100644 --- a/src/v0/destinations/salesforce/transform.js +++ b/src/v0/destinations/salesforce/transform.js @@ -134,7 +134,10 @@ async function getSaleforceIdForRecord( ); } const searchRecord = processedsfSearchResponse.response?.searchRecords?.find( - (rec) => typeof identifierValue !== 'undefined' && rec[identifierType] === `${identifierValue}`, + (rec) => + typeof identifierValue !== 'undefined' && + // eslint-disable-next-line eqeqeq + rec[identifierType] == identifierValue, ); return searchRecord?.Id; @@ -190,8 +193,9 @@ async function getSalesforceIdFromPayload( 'Invalid externalId. id, type, identifierType must be provided', ); } - - const objectType = type.toLowerCase().replace('salesforce-', ''); + const objectType = type + .toLowerCase() + .replace(`${destination.DestinationDefinition.Name.toLowerCase()}-`, ''); let salesforceId = id; // Fetch the salesforce Id if the identifierType is not ID diff --git a/test/integrations/destinations/salesforce/network.ts b/test/integrations/destinations/salesforce/network.ts index b422271d36..b4cff85d7b 100644 --- a/test/integrations/destinations/salesforce/network.ts +++ b/test/integrations/destinations/salesforce/network.ts @@ -180,8 +180,7 @@ const transformationMocksData = [ httpRes: { status: 200, data: { - access_token: - '00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY', + access_token: 'dummy.access.token', instance_url: 'https://ap15.salesforce.com', id: 'https://login.salesforce.com/id/00D2v000002lXbXEAU/0052v00000ga9WqAAI', token_type: 'Bearer', @@ -198,8 +197,7 @@ const transformationMocksData = [ httpRes: { status: 200, data: { - access_token: - '00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY', + access_token: 'dummy.access.token', instance_url: 'https://ap15.salesforce.com', id: 'https://login.salesforce.com/id/00D2v000002lXbXEAU/0052v00000ga9WqAAI', token_type: 'Bearer', @@ -245,6 +243,18 @@ const transformationMocksData = [ }, }, }, + { + httpReq: { + url: 'https://ap15.salesforce.com/services/data/v50.0/parameterizedSearch/?q=72727&sobject=customobject&in=CustomObject__c&customobject.fields=id,CustomObject__c', + method: 'GET', + }, + httpRes: { + status: 200, + data: { + searchRecords: [], + }, + }, + }, { httpReq: { url: 'https://ap15.salesforce.com/services/data/v50.0/parameterizedSearch/?q=peter.gibbons1%40initech.com&sobject=Lead&Lead.fields=id', @@ -265,6 +275,48 @@ const transformationMocksData = [ }, }, }, + { + httpReq: { + url: 'https://ap15.salesforce.com/services/data/v50.0/parameterizedSearch/?q=72728&sobject=customobject2&in=CustomObject2__c&customobject2.fields=id,CustomObject2__c', + method: 'GET', + }, + httpRes: { + status: 200, + data: { + searchRecords: [ + { + attributes: { + type: 'CustomObject2__c', + url: '/services/data/v50.0/CustomObject2__c/id1101', + }, + Id: 'id1101', + CustomObject2__c: 72728, + }, + ], + }, + }, + }, + { + httpReq: { + url: 'https://ap15.salesforce.com/services/data/v50.0/parameterizedSearch/?q=72729&sobject=customobject2&in=CustomObject2__c&customobject2.fields=id,CustomObject2__c', + method: 'GET', + }, + httpRes: { + status: 200, + data: { + searchRecords: [ + { + attributes: { + type: 'CustomObject2__c', + url: '/services/data/v50.0/CustomObject2__c/id1102', + }, + Id: 'id1102', + CustomObject2__c: '72729', + }, + ], + }, + }, + }, { httpReq: { url: 'https://ap15.salesforce.com/services/data/v50.0/parameterizedSearch/?q=ddv_ua%2B%7B%7B1234*245%7D%7D%40bugFix.com&sobject=Lead&Lead.fields=id,IsConverted,ConvertedContactId,IsDeleted', diff --git a/test/integrations/destinations/salesforce/processor/data.ts b/test/integrations/destinations/salesforce/processor/data.ts index 4ccc8cca79..7a44b6b8ed 100644 --- a/test/integrations/destinations/salesforce/processor/data.ts +++ b/test/integrations/destinations/salesforce/processor/data.ts @@ -97,8 +97,7 @@ export const data = [ endpoint: 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead', headers: { 'Content-Type': 'application/json', - Authorization: - 'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY', + Authorization: 'Bearer dummy.access.token', }, params: {}, body: { @@ -225,8 +224,7 @@ export const data = [ endpoint: 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead', headers: { 'Content-Type': 'application/json', - Authorization: - 'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY', + Authorization: 'Bearer dummy.access.token', }, params: {}, body: { @@ -354,8 +352,7 @@ export const data = [ endpoint: 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead', headers: { 'Content-Type': 'application/json', - Authorization: - 'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY', + Authorization: 'Bearer dummy.access.token', }, params: {}, body: { @@ -591,8 +588,7 @@ export const data = [ endpoint: 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead', headers: { 'Content-Type': 'application/json', - Authorization: - 'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY', + Authorization: 'Bearer dummy.access.token', }, params: {}, body: { @@ -721,8 +717,7 @@ export const data = [ endpoint: 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead', headers: { 'Content-Type': 'application/json', - Authorization: - 'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY', + Authorization: 'Bearer dummy.access.token', }, params: {}, body: { @@ -855,8 +850,7 @@ export const data = [ 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Contact/sf-contact-id?_HttpMethod=PATCH', headers: { 'Content-Type': 'application/json', - Authorization: - 'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY', + Authorization: 'Bearer dummy.access.token', }, params: {}, body: { @@ -989,8 +983,7 @@ export const data = [ 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead/sf-contact-id?_HttpMethod=PATCH', headers: { 'Content-Type': 'application/json', - Authorization: - 'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY', + Authorization: 'Bearer dummy.access.token', }, params: {}, userId: '', @@ -1117,8 +1110,7 @@ export const data = [ endpoint: 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead', headers: { 'Content-Type': 'application/json', - Authorization: - 'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY', + Authorization: 'Bearer dummy.access.token', }, params: {}, body: { @@ -1244,8 +1236,7 @@ export const data = [ 'https://ap15.salesforce.com/services/data/v50.0/sobjects/custom_object__c/a005g0000383kmUAAQ?_HttpMethod=PATCH', headers: { 'Content-Type': 'application/json', - Authorization: - 'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY', + Authorization: 'Bearer dummy.access.token', }, params: {}, body: { @@ -1360,8 +1351,7 @@ export const data = [ 'https://ap15.salesforce.com/services/data/v50.0/sobjects/custom_object__c/a005g0000383kmUAAQ?_HttpMethod=PATCH', headers: { 'Content-Type': 'application/json', - Authorization: - 'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY', + Authorization: 'Bearer dummy.access.token', }, params: {}, body: { diff --git a/test/integrations/destinations/salesforce/router/data.ts b/test/integrations/destinations/salesforce/router/data.ts index 4a37f7ed40..9e26625188 100644 --- a/test/integrations/destinations/salesforce/router/data.ts +++ b/test/integrations/destinations/salesforce/router/data.ts @@ -92,8 +92,7 @@ export const data = [ endpoint: 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead', headers: { 'Content-Type': 'application/json', - Authorization: - 'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY', + Authorization: 'Bearer dummy.access.token', }, params: {}, body: { @@ -239,8 +238,7 @@ export const data = [ 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead/leadId?_HttpMethod=PATCH', headers: { 'Content-Type': 'application/json', - Authorization: - 'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY', + Authorization: 'Bearer dummy.access.token', }, params: {}, body: { @@ -385,8 +383,7 @@ export const data = [ endpoint: 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead', headers: { 'Content-Type': 'application/json', - Authorization: - 'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY', + Authorization: 'Bearer dummy.access.token', }, params: {}, body: { @@ -456,8 +453,7 @@ export const data = [ endpoint: 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead', headers: { 'Content-Type': 'application/json', - Authorization: - 'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY', + Authorization: 'Bearer dummy.access.token', }, params: {}, body: { @@ -519,8 +515,7 @@ export const data = [ endpoint: 'https://ap15.salesforce.com/services/data/v50.0/sobjects/Lead', headers: { 'Content-Type': 'application/json', - Authorization: - 'Bearer 00D2v000002lXbX!ARcAQJBSGNA1Rq.MbUdtmlREscrN_nO3ckBz6kc4jRQGxqAzNkhT1XZIF0yPqyCQSnezWO3osMw1ewpjToO7q41E9.LvedWY', + Authorization: 'Bearer dummy.access.token', }, params: {}, body: { @@ -572,4 +567,476 @@ export const data = [ }, }, }, + { + name: 'salesforce', + description: 'Test 4 : Sending custom object for Salesforce-Oauth ', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + input: [ + { + message: { + anonymousId: '1e7673da-9473-49c6-97f7-da848ecafa76', + channel: 'web', + context: { + externalId: [ + { + id: 72727, + type: 'SALESFORCE_OAUTH-CUSTOMOBJECT', + identifierType: 'CustomObject__c', + }, + ], + mappedToDestination: 'true', + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { name: 'RudderLabs JavaScript SDK', version: '1.0.0' }, + locale: 'en-US', + os: { name: '', version: '' }, + screen: { density: 2 }, + traits: { + anonymousId: '1e7673da-9473-49c6-97f7-da848ecafa76', + company: 'Initech', + address: { + city: 'east greenwich', + country: 'USA', + state: 'California', + street: '19123 forest lane', + postalCode: '94115', + }, + email: 'peter.gibbons@initech.com', + name: 'Peter Gibbons', + phone: '570-690-4150', + rating: 'Hot', + title: 'VP of Derp', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36', + }, + integrations: { All: true }, + messageId: 'f19c35da-e9de-4c6e-b6e5-9e60cccc12c8', + originalTimestamp: '2020-01-27T12:20:55.301Z', + receivedAt: '2020-01-27T17:50:58.657+05:30', + request_ip: '14.98.244.60', + sentAt: '2020-01-27T12:20:56.849Z', + timestamp: '2020-01-27T17:50:57.109+05:30', + type: 'identify', + userId: '1e7673da-9473-49c6-97f7-da848ecafa76', + }, + metadata: { jobId: 1, userId: 'u1' }, + destination: { + Config: { + initialAccessToken: 'dummyInitialAccessToken', + password: 'dummyPassword1', + userName: 'testsalesforce1453@gmail.com', + }, + DestinationDefinition: { + DisplayName: 'Salesforce-Oauth', + ID: '1T96GHZ0YZ1qQSLULHCoJkow9KC', + Name: 'SALESFORCE_OAUTH', + }, + Enabled: true, + ID: '1WqFFH5esuVPnUgHkvEoYxDcX3y', + Name: 'tst', + Transformations: [], + }, + }, + ], + destType: 'salesforce', + }, + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + batchedRequest: [ + { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://ap15.salesforce.com/services/data/v50.0/sobjects/customobject', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummy.access.token', + }, + params: {}, + body: { + JSON: { + CustomObject__c: 72727, + address: { + postalCode: '94115', + city: 'east greenwich', + country: 'USA', + state: 'California', + street: '19123 forest lane', + }, + anonymousId: '1e7673da-9473-49c6-97f7-da848ecafa76', + company: 'Initech', + email: 'peter.gibbons@initech.com', + name: 'Peter Gibbons', + phone: '570-690-4150', + rating: 'Hot', + title: 'VP of Derp', + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + ], + metadata: [ + { destInfo: { authKey: '1WqFFH5esuVPnUgHkvEoYxDcX3y' }, jobId: 1, userId: 'u1' }, + ], + batched: false, + statusCode: 200, + destination: { + Config: { + initialAccessToken: 'dummyInitialAccessToken', + password: 'dummyPassword1', + userName: 'testsalesforce1453@gmail.com', + }, + DestinationDefinition: { + DisplayName: 'Salesforce-Oauth', + ID: '1T96GHZ0YZ1qQSLULHCoJkow9KC', + Name: 'SALESFORCE_OAUTH', + }, + Enabled: true, + ID: '1WqFFH5esuVPnUgHkvEoYxDcX3y', + Name: 'tst', + Transformations: [], + }, + }, + ], + }, + }, + }, + }, + { + name: 'salesforce_oauth', + description: + 'Test 5: Sending custom object with external id of different type for Salesforce-Oauth (extId number, apiResponse string) ', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + input: [ + { + message: { + anonymousId: '1e7673da-9473-49c6-97f7-da848ecafa76', + channel: 'web', + context: { + externalId: [ + { + id: 72728, + type: 'SALESFORCE_OAUTH-CUSTOMOBJECT2', + identifierType: 'CustomObject2__c', + }, + ], + mappedToDestination: 'true', + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { name: 'RudderLabs JavaScript SDK', version: '1.0.0' }, + locale: 'en-US', + os: { name: '', version: '' }, + screen: { density: 2 }, + traits: { + anonymousId: '1e7673da-9473-49c6-97f7-da848ecafa76', + company: 'Initech', + address: { + city: 'east greenwich', + country: 'USA', + state: 'California', + street: '19123 forest lane', + postalCode: '94115', + }, + email: 'peter.gibbons@initech.com', + name: 'Peter Gibbons', + phone: '570-690-4150', + rating: 'Hot', + title: 'VP of Derp', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36', + }, + integrations: { All: true }, + messageId: 'f19c35da-e9de-4c6e-b6e5-9e60cccc12c8', + originalTimestamp: '2020-01-27T12:20:55.301Z', + receivedAt: '2020-01-27T17:50:58.657+05:30', + request_ip: '14.98.244.60', + sentAt: '2020-01-27T12:20:56.849Z', + timestamp: '2020-01-27T17:50:57.109+05:30', + type: 'identify', + userId: '1e7673da-9473-49c6-97f7-da848ecafa76', + }, + metadata: { jobId: 1, userId: 'u1' }, + destination: { + Config: { + initialAccessToken: 'dummyInitialAccessToken', + password: 'dummyPassword1', + userName: 'testsalesforce1453@gmail.com', + }, + DestinationDefinition: { + DisplayName: 'Salesforce-Oauth', + ID: '1T96GHZ0YZ1qQSLULHCoJkow9KC', + Name: 'SALESFORCE_OAUTH', + }, + Enabled: true, + ID: '1WqFFH5esuVPnUgHkvEoYxDcX3y', + Name: 'tst', + Transformations: [], + }, + }, + ], + destType: 'salesforce_oauth', + }, + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + batchedRequest: [ + { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://ap15.salesforce.com/services/data/v50.0/sobjects/customobject2/id1101?_HttpMethod=PATCH', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummy.access.token', + }, + params: {}, + body: { + JSON: { + CustomObject2__c: 72728, + address: { + postalCode: '94115', + city: 'east greenwich', + country: 'USA', + state: 'California', + street: '19123 forest lane', + }, + anonymousId: '1e7673da-9473-49c6-97f7-da848ecafa76', + company: 'Initech', + email: 'peter.gibbons@initech.com', + name: 'Peter Gibbons', + phone: '570-690-4150', + rating: 'Hot', + title: 'VP of Derp', + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + ], + metadata: [ + { destInfo: { authKey: '1WqFFH5esuVPnUgHkvEoYxDcX3y' }, jobId: 1, userId: 'u1' }, + ], + batched: false, + statusCode: 200, + destination: { + Config: { + initialAccessToken: 'dummyInitialAccessToken', + password: 'dummyPassword1', + userName: 'testsalesforce1453@gmail.com', + }, + DestinationDefinition: { + DisplayName: 'Salesforce-Oauth', + ID: '1T96GHZ0YZ1qQSLULHCoJkow9KC', + Name: 'SALESFORCE_OAUTH', + }, + Enabled: true, + ID: '1WqFFH5esuVPnUgHkvEoYxDcX3y', + Name: 'tst', + Transformations: [], + }, + }, + ], + }, + }, + }, + }, + { + name: 'salesforce_oauth', + description: + 'Test 6: Sending custom object with external id of different type for Salesforce-Oauth (extId string, apiResponse number) ', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + input: [ + { + message: { + anonymousId: '1e7673da-9473-49c6-97f7-da848ecafa76', + channel: 'web', + context: { + externalId: [ + { + id: '72729', + type: 'SALESFORCE_OAUTH-CUSTOMOBJECT2', + identifierType: 'CustomObject2__c', + }, + ], + mappedToDestination: 'true', + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { name: 'RudderLabs JavaScript SDK', version: '1.0.0' }, + locale: 'en-US', + os: { name: '', version: '' }, + screen: { density: 2 }, + traits: { + anonymousId: '1e7673da-9473-49c6-97f7-da848ecafa76', + company: 'Initech', + address: { + city: 'east greenwich', + country: 'USA', + state: 'California', + street: '19123 forest lane', + postalCode: '94115', + }, + email: 'peter.gibbons@initech.com', + name: 'Peter Gibbons', + phone: '570-690-4150', + rating: 'Hot', + title: 'VP of Derp', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36', + }, + integrations: { All: true }, + messageId: 'f19c35da-e9de-4c6e-b6e5-9e60cccc12c8', + originalTimestamp: '2020-01-27T12:20:55.301Z', + receivedAt: '2020-01-27T17:50:58.657+05:30', + request_ip: '14.98.244.60', + sentAt: '2020-01-27T12:20:56.849Z', + timestamp: '2020-01-27T17:50:57.109+05:30', + type: 'identify', + userId: '1e7673da-9473-49c6-97f7-da848ecafa76', + }, + metadata: { jobId: 1, userId: 'u1' }, + destination: { + Config: { + initialAccessToken: 'dummyInitialAccessToken', + password: 'dummyPassword1', + userName: 'testsalesforce1453@gmail.com', + }, + DestinationDefinition: { + DisplayName: 'Salesforce-Oauth', + ID: '1T96GHZ0YZ1qQSLULHCoJkow9KC', + Name: 'SALESFORCE_OAUTH', + }, + Enabled: true, + ID: '1WqFFH5esuVPnUgHkvEoYxDcX3y', + Name: 'tst', + Transformations: [], + }, + }, + ], + destType: 'salesforce_oauth', + }, + method: 'POST', + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + batchedRequest: [ + { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://ap15.salesforce.com/services/data/v50.0/sobjects/customobject2/id1102?_HttpMethod=PATCH', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummy.access.token', + }, + params: {}, + body: { + JSON: { + CustomObject2__c: '72729', + address: { + postalCode: '94115', + city: 'east greenwich', + country: 'USA', + state: 'California', + street: '19123 forest lane', + }, + anonymousId: '1e7673da-9473-49c6-97f7-da848ecafa76', + company: 'Initech', + email: 'peter.gibbons@initech.com', + name: 'Peter Gibbons', + phone: '570-690-4150', + rating: 'Hot', + title: 'VP of Derp', + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + ], + metadata: [ + { destInfo: { authKey: '1WqFFH5esuVPnUgHkvEoYxDcX3y' }, jobId: 1, userId: 'u1' }, + ], + batched: false, + statusCode: 200, + destination: { + Config: { + initialAccessToken: 'dummyInitialAccessToken', + password: 'dummyPassword1', + userName: 'testsalesforce1453@gmail.com', + }, + DestinationDefinition: { + DisplayName: 'Salesforce-Oauth', + ID: '1T96GHZ0YZ1qQSLULHCoJkow9KC', + Name: 'SALESFORCE_OAUTH', + }, + Enabled: true, + ID: '1WqFFH5esuVPnUgHkvEoYxDcX3y', + Name: 'tst', + Transformations: [], + }, + }, + ], + }, + }, + }, + }, ];