Skip to content

Commit ad96810

Browse files
Copilotabhandage
andcommitted
Add 6 more destinations to centralized versioning-info.ts
Added: - hyperengage (v1) - group, identify, track - launchdarkly-audiences (v2) - listrak (v1) - loops (v1) - index, createOrUpdateContact, sendEvent - magellan-ai (v2) - absmartly (v1) - constant defined Co-authored-by: abhandage <174417010+abhandage@users.noreply.github.com>
1 parent 1412136 commit ad96810

File tree

10 files changed

+60
-10
lines changed

10 files changed

+60
-10
lines changed

packages/destination-actions/src/destinations/hyperengage/group/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import type { ActionDefinition } from '@segment/actions-core'
22
import type { Settings } from '../generated-types'
33
import type { Payload } from './generated-types'
4+
import { HYPERENGAGE_API_VERSION } from '../../versioning-info'
5+
6+
const HYPERENGAGE_BASE_URL = `https://events.hyperengage.io/api/${HYPERENGAGE_API_VERSION}`
47
import { validateInput } from '../validateInput'
58
import { commonFields } from '../commonFields'
69

@@ -92,7 +95,7 @@ const action: ActionDefinition<Settings, Payload> = {
9295
...commonFields
9396
},
9497
perform: (request, data) => {
95-
return request(`https://events.hyperengage.io/api/v1/s2s/event?token=${data.settings.apiKey}`, {
98+
return request(`${HYPERENGAGE_BASE_URL}/s2s/event?token=${data.settings.apiKey}`, {
9699
method: 'post',
97100
json: validateInput(data.settings, data.payload, 'account_identify')
98101
})

packages/destination-actions/src/destinations/hyperengage/identify/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import type { ActionDefinition } from '@segment/actions-core'
22
import type { Settings } from '../generated-types'
33
import type { Payload } from './generated-types'
4+
import { HYPERENGAGE_API_VERSION } from '../../versioning-info'
5+
6+
const HYPERENGAGE_BASE_URL = `https://events.hyperengage.io/api/${HYPERENGAGE_API_VERSION}`
47
import { validateInput } from '../validateInput'
58
import { commonFields } from '../commonFields'
69

@@ -109,7 +112,7 @@ const action: ActionDefinition<Settings, Payload> = {
109112
...commonFields
110113
},
111114
perform: (request, data) => {
112-
return request(`https://events.hyperengage.io/api/v1/s2s/event?token=${data.settings.apiKey}`, {
115+
return request(`${HYPERENGAGE_BASE_URL}/s2s/event?token=${data.settings.apiKey}`, {
113116
method: 'post',
114117
json: validateInput(data.settings, data.payload, 'user_identify')
115118
})

packages/destination-actions/src/destinations/hyperengage/track/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import type { ActionDefinition } from '@segment/actions-core'
22
import type { Settings } from '../generated-types'
33
import type { Payload } from './generated-types'
4+
import { HYPERENGAGE_API_VERSION } from '../../versioning-info'
5+
6+
const HYPERENGAGE_BASE_URL = `https://events.hyperengage.io/api/${HYPERENGAGE_API_VERSION}`
47
import { validateInput } from '../validateInput'
58
import { commonFields } from '../commonFields'
69

@@ -46,7 +49,7 @@ const action: ActionDefinition<Settings, Payload> = {
4649
...commonFields
4750
},
4851
perform: (request, data) => {
49-
return request(`https://events.hyperengage.io/api/v1/s2s/event?token=${data.settings.apiKey}`, {
52+
return request(`${HYPERENGAGE_BASE_URL}/s2s/event?token=${data.settings.apiKey}`, {
5053
method: 'post',
5154
json: validateInput(data.settings, data.payload, 'track')
5255
})

packages/destination-actions/src/destinations/launchdarkly-audiences/constants.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import { LAUNCHDARKLY_AUDIENCES_API_VERSION } from '../versioning-info'
2+
13
export const CONSTANTS = {
24
LD_CLIENT_SDK_BASE_URL: 'https://clientsdk.launchdarkly.com',
3-
LD_API_BASE_URL: 'https://app.launchdarkly.com/api/v2',
5+
LD_API_BASE_URL: `https://app.launchdarkly.com/api/${LAUNCHDARKLY_AUDIENCES_API_VERSION}`,
46

57
LD_API_CUSTOM_AUDIENCE_ENDPOINT: '/segment-targets/segment-audiences',
68
ADD: 'ADD',

packages/destination-actions/src/destinations/listrak/updateEmailContactProfileFields/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import type { ActionDefinition } from '@segment/actions-core'
22
import type { Settings } from '../generated-types'
33
import type { Payload } from './generated-types'
4+
import { LISTRAK_API_VERSION } from '../../versioning-info'
5+
6+
const LISTRAK_BASE_URL = `https://api.listrak.com/email/${LISTRAK_API_VERSION}`
47
import { RequestClient } from '@segment/actions-core'
58

69
export type SegmentationFieldValue = {
@@ -112,7 +115,7 @@ async function processPayload(request: RequestClient, payload: Payload[]) {
112115
})
113116

114117
for (const listId in requestsByListId) {
115-
await request(`https://api.listrak.com/email/v1/List/${listId}/Contact/SegmentationField`, {
118+
await request(`${LISTRAK_BASE_URL}/List/${listId}/Contact/SegmentationField`, {
116119
method: 'POST',
117120
json: requestsByListId[listId]
118121
})

packages/destination-actions/src/destinations/loops/createOrUpdateContact/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import type { ActionDefinition } from '@segment/actions-core'
22
import type { Settings } from '../generated-types'
33
import type { Payload } from './generated-types'
4+
import { LOOPS_API_VERSION } from '../../versioning-info'
5+
6+
const LOOPS_BASE_URL = `https://app.loops.so/api/${LOOPS_API_VERSION}`
47

58
const action: ActionDefinition<Settings, Payload> = {
69
title: 'Create or update a contact',
@@ -117,7 +120,7 @@ const action: ActionDefinition<Settings, Payload> = {
117120
delete customAttributes.mailingLists
118121
}
119122

120-
return request('https://app.loops.so/api/v1/contacts/update', {
123+
return request(`${LOOPS_BASE_URL}/contacts/update`, {
121124
method: 'put',
122125
json: {
123126
...(typeof customAttributes === 'object' && customAttributes),

packages/destination-actions/src/destinations/loops/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const destination: DestinationDefinition<Settings> = {
2626
}
2727
},
2828
testAuthentication: (request) => {
29-
return request('https://app.loops.so/api/v1/api-key', { method: 'GET' })
29+
return request(`${LOOPS_BASE_URL}/api-key`, { method: 'GET' })
3030
}
3131
},
3232

@@ -35,7 +35,7 @@ const destination: DestinationDefinition<Settings> = {
3535
sendEvent
3636
},
3737
onDelete: async (request, { payload }) => {
38-
return request('https://app.loops.so/api/v1/contacts/delete', {
38+
return request(`${LOOPS_BASE_URL}/contacts/delete`, {
3939
method: 'POST',
4040
json: {
4141
userId: [payload.userId]

packages/destination-actions/src/destinations/loops/sendEvent/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import type { ActionDefinition } from '@segment/actions-core'
22
import type { Settings } from '../generated-types'
33
import type { Payload } from './generated-types'
4+
import { LOOPS_API_VERSION } from '../../versioning-info'
5+
6+
const LOOPS_BASE_URL = `https://app.loops.so/api/${LOOPS_API_VERSION}`
47

58
type SendEventPayload = {
69
email?: string
@@ -61,7 +64,7 @@ const action: ActionDefinition<Settings, Payload> = {
6164
}
6265
},
6366
perform: (request, { payload }) => {
64-
return request('https://app.loops.so/api/v1/events/send', {
67+
return request(`${LOOPS_BASE_URL}/events/send`, {
6568
method: 'post',
6669
json: {
6770
email: payload.email,

packages/destination-actions/src/destinations/magellan-ai/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const destination: DestinationDefinition<Settings> = {
3838
onDelete: async (request: RequestClient, { payload, settings }) => {
3939
if (!settings.apiToken) return
4040

41-
return request('https://api.magellan.ai/v2/gdpr/delete', {
41+
return request(`${MAGELLAN_AI_BASE_URL}/gdpr/delete`, {
4242
method: 'post',
4343
headers: { Authorization: `Bearer ${settings.apiToken}` },
4444
json: { ...payload, pixelToken: settings.pixelToken }

packages/destination-actions/src/destinations/versioning-info.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,3 +343,33 @@ export const HILO_API_VERSION = 'v1'
343343
* HubSpot CRM API Version
344344
*/
345345
export const HUBSPOT_API_VERSION = 'v3'
346+
347+
/**
348+
* ABsmartly API Version
349+
*/
350+
export const ABSMARTLY_API_VERSION = 'v1'
351+
352+
/**
353+
* HyperEngage API Version
354+
*/
355+
export const HYPERENGAGE_API_VERSION = 'v1'
356+
357+
/**
358+
* LaunchDarkly Audiences API Version
359+
*/
360+
export const LAUNCHDARKLY_AUDIENCES_API_VERSION = 'v2'
361+
362+
/**
363+
* Listrak API Version
364+
*/
365+
export const LISTRAK_API_VERSION = 'v1'
366+
367+
/**
368+
* Loops API Version
369+
*/
370+
export const LOOPS_API_VERSION = 'v1'
371+
372+
/**
373+
* Magellan AI API Version
374+
*/
375+
export const MAGELLAN_AI_API_VERSION = 'v2'

0 commit comments

Comments
 (0)