Skip to content

Commit

Permalink
Remove hyphens from customer id in create/get Audience calls (#2319)
Browse files Browse the repository at this point in the history
* Remove hyphens from customer id in create/get Audience calls

* getAudience to return if segment in db

* Address comment
  • Loading branch information
maryamsharif authored Aug 20, 2024
1 parent 18b12b2 commit c2afe32
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import uploadCallConversion from './uploadCallConversion'
import uploadClickConversion from './uploadClickConversion'
import uploadConversionAdjustment from './uploadConversionAdjustment'
import { CreateAudienceInput, GetAudienceInput, UserListResponse } from './types'
import { createGoogleAudience, getGoogleAudience } from './functions'
import { createGoogleAudience, getGoogleAudience, verifyCustomerId } from './functions'
import uploadCallConversion2 from './uploadCallConversion2'
import userList from './userList'
import uploadClickConversion2 from './uploadClickConversion2'
Expand Down Expand Up @@ -112,6 +112,7 @@ const destination: AudienceDestinationDefinition<Settings> = {
full_audience_sync: false // If true, we send the entire audience. If false, we just send the delta.
},
async createAudience(request, createAudienceInput: CreateAudienceInput) {
createAudienceInput.settings.customerId = verifyCustomerId(createAudienceInput.settings.customerId)
const auth = createAudienceInput.settings.oauth
const userListId = await createGoogleAudience(
request,
Expand All @@ -126,6 +127,14 @@ const destination: AudienceDestinationDefinition<Settings> = {
},

async getAudience(request, getAudienceInput: GetAudienceInput) {
// The connections that were created before the audience methods
// were added will have the externalId field as segment.
if (getAudienceInput.externalId === 'segment') {
return {
externalId: getAudienceInput.externalId
}
}
getAudienceInput.settings.customerId = verifyCustomerId(getAudienceInput.settings.customerId)
const response: UserListResponse = await getGoogleAudience(
request,
getAudienceInput.settings,
Expand Down

0 comments on commit c2afe32

Please sign in to comment.