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 { Payload } from './updateSegment/generated-types'
import { YahooPayload } from './types'
import { gen_random_id } from './utils-tax'
import { processHashing } from '../../lib/hashing-utils'
import { YAHOO_AUDIENCES_TAXONOMY_API_VERSION } from './versioning-info'

/**
* Creates a SHA256 hash from the input
Expand All @@ -23,7 +24,7 @@ export function create_hash(input: string | undefined): string | undefined {
export function generate_jwt(client_id: string, client_secret: string): string {
const random_id = gen_random_id(24)
const current_time = Math.floor(new Date().getTime() / 1000)
const url = 'https://id.b2b.yahooincapis.com/zts/v1'
const url = `https://id.b2b.yahooincapis.com/zts/${YAHOO_AUDIENCES_TAXONOMY_API_VERSION}`
const jwt_payload = {
iss: client_id,
sub: client_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import { StatsClient } from '@segment/actions-core/destination-kit'
import { generate_jwt } from './utils-rt'

// Constants for Yahoo Taxonomy API
import { YAHOO_AUDIENCES_TAXONOMY_API_VERSION } from './versioning-info'
const TAXONOMY_CLIENT_KEY_PREFIX = 'idb2b.dsp.datax'
const TAXONOMY_TOKEN_ENDPOINT = 'https://id.b2b.yahooincapis.com/zts/v1/oauth2/token'
const TAXONOMY_AUDIENCE_URL = 'https://id.b2b.yahooincapis.com/zts/v1'
const TAXONOMY_TOKEN_ENDPOINT = `https://id.b2b.yahooincapis.com/zts/${YAHOO_AUDIENCES_TAXONOMY_API_VERSION}/oauth2/token`
const TAXONOMY_AUDIENCE_URL = `https://id.b2b.yahooincapis.com/zts/${YAHOO_AUDIENCES_TAXONOMY_API_VERSION}`
const TAXONOMY_SCOPE = 'idb2b.dsp.datax:role.online.writer'

export function gen_customer_taxonomy_payload(settings: Settings) {
Expand Down Expand Up @@ -103,11 +104,12 @@ 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 : ''
}`

// Get a short-lived Bearer token using the same JWT client-credentials flow as the Online API
const access_token = await get_taxonomy_access_token(request, tx_client_key, tx_client_secret)

try {
const add_segment_node = await request(url, {
method: 'PUT',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** 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