From 5dade8942e3b59d3f0f36f5543f6e38d41f2aab5 Mon Sep 17 00:00:00 2001 From: Yashasvi Bajpai <33063622+yashasvibajpai@users.noreply.github.com> Date: Wed, 3 Jan 2024 13:52:40 +0530 Subject: [PATCH] chore: add endpoint labels (#2951) chore: add endpoint labelsx3 Co-authored-by: Sudip Paul <67197965+ItsSudip@users.noreply.github.com> --- src/v0/destinations/active_campaign/transform.js | 4 ++++ src/v0/destinations/canny/util.js | 1 + src/v0/destinations/custify/util.js | 1 + src/v0/destinations/freshmarketer/utils.js | 7 +++++++ src/v0/destinations/freshsales/utils.js | 5 +++++ .../google_adwords_offline_conversions/networkHandler.js | 1 + src/v0/destinations/hs/util.js | 2 ++ src/v0/destinations/marketo/util.js | 1 + src/v0/destinations/user/utils.js | 7 +++++++ src/v0/destinations/wootric/util.js | 2 ++ 10 files changed, 31 insertions(+) diff --git a/src/v0/destinations/active_campaign/transform.js b/src/v0/destinations/active_campaign/transform.js index 90e6b2080f..981dbd7520 100644 --- a/src/v0/destinations/active_campaign/transform.js +++ b/src/v0/destinations/active_campaign/transform.js @@ -128,6 +128,7 @@ const customTagProcessor = async (message, category, destination, contactId) => const resp = httpGET(endpoint, requestOptions, { destType: 'active_campaign', feature: 'transformation', + endpointPath: `/api/3/tags`, }); promises.push(resp); } @@ -251,6 +252,7 @@ const customFieldProcessor = async (message, category, destination) => { const resp = httpGET(endpoint, requestOpt, { destType: 'active_campaign', feature: 'transformation', + endpointPath: `/api/3/fields`, }); promises.push(resp); } @@ -406,6 +408,7 @@ const screenRequestHandler = async (message, category, destination) => { res = await httpGET(endpoint, requestOptions, { destType: 'active_campaign', feature: 'transformation', + endpointPath: `/api/3/eventTrackingEvents`, }); if (res.success === false) { errorHandler(res, 'Failed to retrieve events'); @@ -469,6 +472,7 @@ const trackRequestHandler = async (message, category, destination) => { let res = await httpGET(endpoint, requestOptions, { destType: 'active_campaign', feature: 'transformation', + endpointPath: `/api/3/eventTrackingEvents`, }); if (res.success === false) { diff --git a/src/v0/destinations/canny/util.js b/src/v0/destinations/canny/util.js index 59644bcd6b..f514a01e5c 100644 --- a/src/v0/destinations/canny/util.js +++ b/src/v0/destinations/canny/util.js @@ -45,6 +45,7 @@ const retrieveUserId = async (apiKey, message) => { { destType: 'canny', feature: 'transformation', + endpointPath: `/v1/users/retrieve`, }, ); logger.debug(response); diff --git a/src/v0/destinations/custify/util.js b/src/v0/destinations/custify/util.js index ae6f21fe20..8ecabccd2e 100644 --- a/src/v0/destinations/custify/util.js +++ b/src/v0/destinations/custify/util.js @@ -40,6 +40,7 @@ const createUpdateCompany = async (companyPayload, Config) => { { destType: 'custify', feature: 'transformation', + endpointPath: `/company`, }, ); const processedCompanyResponse = processAxiosResponse(companyResponse); diff --git a/src/v0/destinations/freshmarketer/utils.js b/src/v0/destinations/freshmarketer/utils.js index 6fa1fe9976..5e3ba6e67e 100644 --- a/src/v0/destinations/freshmarketer/utils.js +++ b/src/v0/destinations/freshmarketer/utils.js @@ -49,6 +49,7 @@ const createUpdateAccount = async (payload, Config) => { let accountResponse = await httpPOST(endPoint, payloadBody, requestOptions, { destType: 'freshmarketer', feature: 'transformation', + endpointPath: `/crm/sales/api/sales_accounts/upsert`, }); accountResponse = processAxiosResponse(accountResponse); if (accountResponse.status !== 200 && accountResponse.status !== 201) { @@ -93,6 +94,7 @@ const getUserAccountDetails = async (payload, userEmail, Config) => { let userSalesAccountResponse = await httpPOST(endPoint, userPayload, requestOptions, { destType: 'freshmarketer', feature: 'transformation', + endpointPath: `crm/sales/api/contacts/upsert?include=sales_accounts`, }); userSalesAccountResponse = processAxiosResponse(userSalesAccountResponse); if (userSalesAccountResponse.status !== 200 && userSalesAccountResponse.status !== 201) { @@ -142,6 +144,7 @@ const createOrUpdateListDetails = async (listName, Config) => { let listResponse = await httpGET(endPoint, requestOptions, { destType: 'freshmarketer', feature: 'transformation', + endpointPath: `/crm/sales/api/lists`, }); listResponse = processAxiosResponse(listResponse); if (listResponse.status !== 200) { @@ -161,6 +164,7 @@ const createOrUpdateListDetails = async (listName, Config) => { listResponse = await httpPOST(endPoint, { name: listName }, requestOptions, { destType: 'freshmarketer', feature: 'transformation', + endpointPath: `/crm/sales/api/lists`, }); listResponse = processAxiosResponse(listResponse); if (listResponse.status !== 200) { @@ -235,6 +239,7 @@ const getContactsDetails = async (userEmail, Config) => { let userResponse = await httpPOST(endPoint, userPayload, requestOptions, { destType: 'freshmarketer', feature: 'transformation', + endpointPath: `/crm/sales/api/contacts/upsert`, }); userResponse = processAxiosResponse(userResponse); if (userResponse.status !== 200 && userResponse.status !== 201) { @@ -308,6 +313,7 @@ const UpdateContactWithLifeCycleStage = async (message, Config) => { let lifeCycleStagesResponse = await httpGET(endPoint, requestOptions, { destType: 'freshmarketer', feature: 'transformation', + endpointPath: `/crm/sales/api/selector/lifecycle_stages`, }); lifeCycleStagesResponse = processAxiosResponse(lifeCycleStagesResponse); if (lifeCycleStagesResponse.status !== 200) { @@ -393,6 +399,7 @@ const UpdateContactWithSalesActivity = async (payload, message, Config) => { let salesActivityResponse = await httpGET(endPoint, requestOptions, { destType: 'freshmarketer', feature: 'transformation', + endpointPath: `/crm/sales/api/selector/sales_activity_types`, }); salesActivityResponse = processAxiosResponse(salesActivityResponse); if (salesActivityResponse.status !== 200) { diff --git a/src/v0/destinations/freshsales/utils.js b/src/v0/destinations/freshsales/utils.js index 96acabb037..5008fedc2d 100644 --- a/src/v0/destinations/freshsales/utils.js +++ b/src/v0/destinations/freshsales/utils.js @@ -47,6 +47,7 @@ const createUpdateAccount = async (payload, Config) => { let accountResponse = await httpPOST(endPoint, payloadBody, requestOptions, { destType: 'freshsales', feature: 'transformation', + endpointPath: `/crm/sales/api/sales_accounts/upsert`, }); accountResponse = processAxiosResponse(accountResponse); if (accountResponse.status !== 200 && accountResponse.status !== 201) { @@ -90,6 +91,7 @@ const getUserAccountDetails = async (payload, userEmail, Config) => { let userSalesAccountResponse = await httpPOST(endPoint, userPayload, requestOptions, { destType: 'freshsales', feature: 'transformation', + endpointPath: `/crm/sales/api/contacts/upsert?include=sales_accounts`, }); userSalesAccountResponse = processAxiosResponse(userSalesAccountResponse); if (userSalesAccountResponse.status !== 200 && userSalesAccountResponse.status !== 201) { @@ -145,6 +147,7 @@ const getContactsDetails = async (userEmail, Config) => { let userResponse = await httpPOST(endPoint, userPayload, requestOptions, { destType: 'freshsales', feature: 'transformation', + endpointPath: `/crm/sales/api/contacts/upsert`, }); userResponse = processAxiosResponse(userResponse); if (userResponse.status !== 200 && userResponse.status !== 201) { @@ -235,6 +238,7 @@ const UpdateContactWithSalesActivity = async (payload, message, Config) => { let salesActivityResponse = await httpGET(endPoint, requestOptions, { destType: 'freshsales', feature: 'transformation', + endpointPath: `/crm/sales/api/sales_activity_types`, }); salesActivityResponse = processAxiosResponse(salesActivityResponse); if (salesActivityResponse.status !== 200) { @@ -314,6 +318,7 @@ const UpdateContactWithLifeCycleStage = async (message, Config) => { let lifeCycleStagesResponse = await httpGET(endPoint, requestOptions, { destType: 'freshsales', feature: 'transformation', + endpointPath: `/crm/sales/api/lifecycle_stages`, }); lifeCycleStagesResponse = processAxiosResponse(lifeCycleStagesResponse); if (lifeCycleStagesResponse.status !== 200) { diff --git a/src/v0/destinations/google_adwords_offline_conversions/networkHandler.js b/src/v0/destinations/google_adwords_offline_conversions/networkHandler.js index e880f97d0d..6922cde8c8 100644 --- a/src/v0/destinations/google_adwords_offline_conversions/networkHandler.js +++ b/src/v0/destinations/google_adwords_offline_conversions/networkHandler.js @@ -246,6 +246,7 @@ const ProxyRequest = async (request) => { const response = await httpSend(requestBody, { feature: 'proxy', destType: 'gogole_adwords_offline_conversions', + endpointPath: `/proxy`, }); return response; }; diff --git a/src/v0/destinations/hs/util.js b/src/v0/destinations/hs/util.js index f83ce0b6de..5c8f4a908a 100644 --- a/src/v0/destinations/hs/util.js +++ b/src/v0/destinations/hs/util.js @@ -100,6 +100,7 @@ const getProperties = async (destination) => { hubspotPropertyMapResponse = await httpGET(CONTACT_PROPERTY_MAP_ENDPOINT, requestOptions, { destType: 'hs', feature: 'transformation', + endpointPath: `/properties/v1/contacts/properties`, }); hubspotPropertyMapResponse = processAxiosResponse(hubspotPropertyMapResponse); } else { @@ -111,6 +112,7 @@ const getProperties = async (destination) => { { destType: 'hs', feature: 'transformation', + endpointPath: `/properties/v1/contacts/properties?hapikey`, }, ); hubspotPropertyMapResponse = processAxiosResponse(hubspotPropertyMapResponse); diff --git a/src/v0/destinations/marketo/util.js b/src/v0/destinations/marketo/util.js index 4dc576ec16..54ff70708a 100644 --- a/src/v0/destinations/marketo/util.js +++ b/src/v0/destinations/marketo/util.js @@ -247,6 +247,7 @@ const sendGetRequest = async (url, options) => { const clientResponse = await httpGET(url, options, { destType: 'marketo', feature: 'transformation', + endpointPath: `/v1/leads`, }); const processedResponse = processAxiosResponse(clientResponse); return processedResponse; diff --git a/src/v0/destinations/user/utils.js b/src/v0/destinations/user/utils.js index 41ad173583..52fba2167e 100644 --- a/src/v0/destinations/user/utils.js +++ b/src/v0/destinations/user/utils.js @@ -237,6 +237,7 @@ const createCompany = async (message, destination) => { const response = await httpPOST(endpoint, payload, requestOptions, { destType: 'user', feature: 'transformation', + endpointPath: `/companies/`, }); const data = processAxiosResponse(response); return data.response; @@ -277,6 +278,7 @@ const updateCompany = async (message, destination, company) => { const response = await httpPUT(endpoint, payload, requestOptions, { destType: 'user', feature: 'transformation', + endpointPath: `/companies/`, }); const data = processAxiosResponse(response); return data.response; @@ -303,6 +305,7 @@ const getUserByUserKey = async (apiKey, userKey, appSubdomain) => { const userResponse = await httpGET(endpoint, requestOptions, { destType: 'user', feature: 'transformation', + endpointPath: `/users/search`, }); const processedUserResponse = processAxiosResponse(userResponse); if (processedUserResponse.status === 200) { @@ -336,6 +339,7 @@ const getUserByEmail = async (apiKey, email, appSubdomain) => { const userResponse = await httpGET(endpoint, requestOptions, { destType: 'user', feature: 'transformation', + endpointPath: `/users/search/?email`, }); const processedUserResponse = processAxiosResponse(userResponse); @@ -374,6 +378,7 @@ const getUserByPhoneNumber = async (apiKey, phoneNumber, appSubdomain) => { const userResponse = await httpGET(endpoint, requestOptions, { destType: 'user', feature: 'transformation', + endpointPath: `/users/search/?phone_number`, }); const processedUserResponse = processAxiosResponse(userResponse); @@ -418,6 +423,7 @@ const getUserByCustomId = async (message, destination) => { const userResponse = await httpGET(endpoint, requestOptions, { destType: 'user', feature: 'transformation', + endpointPath: `/users-by-id/`, }); const processedUserResponse = processAxiosResponse(userResponse); @@ -453,6 +459,7 @@ const getCompanyByCustomId = async (message, destination) => { const response = await httpGET(endpoint, requestOptions, { destType: 'user', feature: 'transformation', + endpointPath: `/companies-by-id/`, }); const processedUserResponse = processAxiosResponse(response); if (processedUserResponse.status === 200) { diff --git a/src/v0/destinations/wootric/util.js b/src/v0/destinations/wootric/util.js index fce8a66586..eb61a472cf 100644 --- a/src/v0/destinations/wootric/util.js +++ b/src/v0/destinations/wootric/util.js @@ -46,6 +46,7 @@ const getAccessToken = async (destination) => { const wootricAuthResponse = await httpPOST(request.url, request.data, request.header, { destType: 'wootric', feature: 'transformation', + endpointPath: `/oauth/token`, }); const processedAuthResponse = processAxiosResponse(wootricAuthResponse); // If the request fails, throwing error. @@ -98,6 +99,7 @@ const retrieveUserDetails = async (endUserId, externalId, accessToken) => { const userResponse = await httpGET(endpoint, requestOptions, { destType: 'wootric', feature: 'transformation', + endpointPath: `/v1/end_users/`, }); const processedUserResponse = processAxiosResponse(userResponse);