Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { Features, IntegrationError, RequestClient, StatsContext } from '@segmen
import { Payload } from './addToAudContactInfo/generated-types'
import { Payload as DeviceIdPayload } from './addToAudMobileDeviceId/generated-types'
import { processHashing } from '../../lib/hashing-utils'
import { FIRST_PARTY_DV360_API_VERSION, FIRST_PARTY_DV360_CANARY_API_VERSION } from './versioning-info'

export const API_VERSION = 'v4'
export const CANARY_API_VERSION = 'v4'
export const API_VERSION = FIRST_PARTY_DV360_API_VERSION
export const CANARY_API_VERSION = FIRST_PARTY_DV360_CANARY_API_VERSION
export const FLAGON_NAME = 'first-party-dv360-canary-version'

const DV360API = `https://displayvideo.googleapis.com/`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** FIRST_PARTY_DV360_API_VERSION
* DV360 First Party Audience API version.
* API reference: https://developers.google.com/display-video/api/reference/rest/v4/firstPartyAndPartnerAudiences/create
*/
export const FIRST_PARTY_DV360_API_VERSION = 'v4'

/** FIRST_PARTY_DV360_CANARY_API_VERSION
* DV360 First Party Audience API canary version.
* API reference: https://developers.google.com/display-video/api/reference/rest/v4/firstPartyAndPartnerAudiences/create
*/
export const FIRST_PARTY_DV360_CANARY_API_VERSION = 'v4'
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { ROKT_API_VERSION } from './versioning-info'

export const CONSTANTS = {
// rokt
INCLUDE: 'include',
EXCLUDE: 'exclude',
ROKT_API_BASE_URL: 'https://data.rokt.com/v3',
ROKT_API_BASE_URL: `https://data.rokt.com/${ROKT_API_VERSION}`,
ROKT_API_CUSTOM_AUDIENCE_ENDPOINT: '/import/suppression',
ROKT_API_AUTH_ENDPOINT: '/auth-check',

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** ROKT_API_VERSION
* Rokt audiences API version.
* API reference: https://docs.rokt.com/developers/api-reference/custom-audience-import
*/
export const ROKT_API_VERSION = 'v3'
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { SEGMENT_PROFILES_API_VERSION } from './versioning-info'

interface SegmentEndpoint {
label: string
url: string
Expand All @@ -7,22 +9,22 @@ interface SegmentEndpoint {
const SEG_ENDPOINT: { [key: string]: SegmentEndpoint } = {
north_america: {
label: 'North America',
url: 'https://api.segment.io/v1',
cdn: 'https://cdn.segment.com/v1',
url: `https://api.segment.io/${SEGMENT_PROFILES_API_VERSION}`,
cdn: `https://cdn.segment.com/${SEGMENT_PROFILES_API_VERSION}`,
papi: 'https://api.segmentapis.com'
},
europe: {
label: 'Europe',
url: 'https://events.eu1.segmentapis.com/v1',
cdn: 'https://cdn.segment.com/v1',
url: `https://events.eu1.segmentapis.com/${SEGMENT_PROFILES_API_VERSION}`,
cdn: `https://cdn.segment.com/${SEGMENT_PROFILES_API_VERSION}`,
papi: 'https://eu1.api.segmentapis.com'
}
}
if (process.env.NODE_ENV != 'production') {
SEG_ENDPOINT.stage = {
label: 'Staging',
url: 'https://api.segment.build/v1',
cdn: 'https://cdn.segment.build/v1',
url: `https://api.segment.build/${SEGMENT_PROFILES_API_VERSION}`,
cdn: `https://cdn.segment.build/${SEGMENT_PROFILES_API_VERSION}`,
papi: 'https://api.segmentapis.build'
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** SEGMENT_PROFILES_API_VERSION
* Segment Profiles API version.
* API reference : https://docs.segmentapis.com/tag/Audiences
*/
export const SEGMENT_PROFILES_API_VERSION = 'v1'
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ActionDefinition } from '@segment/actions-core'
import type { Settings } from '../generated-types'
import type { Payload } from './generated-types'
import { TALON_ONE_API_VERSION } from '../versioning-info'
import { attribute, customerProfileId } from '../t1-properties'

const action: ActionDefinition<Settings, Payload> = {
Expand Down Expand Up @@ -40,7 +41,7 @@ const action: ActionDefinition<Settings, Payload> = {
}
},
perform: (request, { payload }) => {
let requestUrl = `https://integration.talon.one/segment/v2/events`
let requestUrl = `https://integration.talon.one/segment/${TALON_ONE_API_VERSION}/events`
if (payload.skipNonExistingAttributes) {
requestUrl += '?skipNonExistingAttributes=true'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ActionDefinition } from '@segment/actions-core'
import type { Settings } from '../generated-types'
import type { Payload } from './generated-types'
import { TALON_ONE_API_VERSION } from '../versioning-info'
import { attribute, addAudienceId, deleteAudienceId, customerProfileId } from '../t1-properties'

const action: ActionDefinition<Settings, Payload> = {
Expand Down Expand Up @@ -28,7 +29,7 @@ const action: ActionDefinition<Settings, Payload> = {
attributes: { ...attribute }
},
perform: (request, { payload }) => {
let requestUrl = `https://integration.talon.one/segment/v2/customer_profiles/${payload.customerProfileId}`
let requestUrl = `https://integration.talon.one/segment/${TALON_ONE_API_VERSION}/customer_profiles/${payload.customerProfileId}`
if (payload.skipNonExistingAttributes) {
requestUrl += '?skipNonExistingAttributes=true'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ActionDefinition } from '@segment/actions-core'
import type { Settings } from '../generated-types'
import type { Payload } from './generated-types'
import { attribute, cartItems, customerProfileId, identifier } from '../t1-properties'
import { TALON_ONE_API_VERSION } from '../versioning-info'

const action: ActionDefinition<Settings, Payload> = {
title: 'Update customer session',
Expand Down Expand Up @@ -97,7 +98,7 @@ const action: ActionDefinition<Settings, Payload> = {
}
},
perform: (request, { payload }) => {
let requestUrl = `https://integration.talon.one/segment/v2/customer_sessions/${payload.customerSessionId}`
let requestUrl = `https://integration.talon.one/segment/${TALON_ONE_API_VERSION}/customer_sessions/${payload.customerSessionId}`
if (payload.skipNonExistingAttributes) {
requestUrl += '?skipNonExistingAttributes=true'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** TALON_ONE_API_VERSION
* Talon.One integration API version.
* API reference : https://docs.talon.one/integration-api/
*/
export const TALON_ONE_API_VERSION = 'v2'
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createHmac } from 'crypto'
import { CredsObj, YahooSubTaxonomy } from './types'
import { RequestClient, IntegrationError } from '@segment/actions-core'
import { StatsClient } from '@segment/actions-core/destination-kit'
import { YAHOO_AUDIENCES_OAUTH_VERSION, YAHOO_AUDIENCES_TAXONOMY_API_VERSION } from './versioning-info'

export function gen_customer_taxonomy_payload(settings: Settings) {
const data = {
Expand Down Expand Up @@ -63,7 +64,7 @@ export function gen_oauth1_signature(client_key: string, client_secret: string,
.update(base_string)
.digest('base64')
)
const oauth1_auth_string = `OAuth oauth_consumer_key="${client_key}", oauth_nonce="${nonce}", oauth_signature="${signature}", oauth_signature_method="HMAC-SHA1", oauth_timestamp="${timestamp}", oauth_version="1.0"`
const oauth1_auth_string = `OAuth oauth_consumer_key="${client_key}", oauth_nonce="${nonce}", oauth_signature="${signature}", oauth_signature_method="HMAC-SHA1", oauth_timestamp="${timestamp}", oauth_version="${YAHOO_AUDIENCES_OAUTH_VERSION}"`
return oauth1_auth_string
}

Expand All @@ -77,7 +78,9 @@ export async function update_taxonomy(
) {
const tx_client_secret = tx_creds.tx_client_secret
const tx_client_key = tx_creds.tx_client_key
const url = `https://datax.yahooapis.com/v1/taxonomy/append${engage_space_id.length > 0 ? '/' + engage_space_id : ''}`
const url = `https://datax.yahooapis.com/${YAHOO_AUDIENCES_TAXONOMY_API_VERSION}/taxonomy/append${
engage_space_id.length > 0 ? '/' + engage_space_id : ''
}`
const oauth1_auth_string = gen_oauth1_signature(tx_client_key, tx_client_secret, 'PUT', url)
try {
const add_segment_node = await request(url, {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** YAHOO_AUDIENCES_OAUTH_VERSION
* Yahoo Audiences OAuth 1.0a version.
* API reference: https://help.yahooinc.com/datax/docs/security-authentication
*/
export const YAHOO_AUDIENCES_OAUTH_VERSION = '1.0'

/** YAHOO_AUDIENCES_TAXONOMY_API_VERSION
* Yahoo Audiences taxonomy API version.
* API reference: https://help.yahooinc.com/datax/docs/put-append-taxonomy-node
*/
export const YAHOO_AUDIENCES_TAXONOMY_API_VERSION = 'v1'
Loading