Skip to content

Commit

Permalink
Splits off engage and retl AdAccountId settings, fun fact: these cann…
Browse files Browse the repository at this point in the history
…ot share a slug
  • Loading branch information
nick-Ag committed Jul 23, 2024
1 parent 0a1285a commit 3ea1444
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const destination: AudienceDestinationDefinition<Settings, AudienceSettings> = {
authentication: {
scheme: 'oauth2',
fields: {
adAccountId
retlAdAccountId: adAccountId
},
refreshAccessToken: async () => {
return { accessToken: 'TODO: Implement this' }
Expand All @@ -30,7 +30,7 @@ const destination: AudienceDestinationDefinition<Settings, AudienceSettings> = {
}
},
audienceFields: {
adAccountId,
engageAdAccountId: adAccountId,
audienceDescription: {
type: 'string',
label: 'Description',
Expand All @@ -45,7 +45,7 @@ const destination: AudienceDestinationDefinition<Settings, AudienceSettings> = {
},
async createAudience(request, createAudienceInput) {
const audienceName = createAudienceInput.audienceName
const adAccountId = createAudienceInput.audienceSettings?.adAccountId
const adAccountId = createAudienceInput.audienceSettings?.engageAdAccountId
const audienceDescription = createAudienceInput.audienceSettings?.audienceDescription

if (!audienceName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ const action: ActionDefinition<Settings, Payload> = {
hooks: {
retlOnMappingSave: {
label: 'Select or create an audience in Facebook',
description: 'TODO: Create or select an audience in Facebook.',
description:
'When saving this mapping, Segment will either create a new audience in Facebook or connect to an existing one. To create a new audience, enter the name of the audience. To connect to an existing audience, select the audience ID from the dropdown.',
inputFields: {
audienceName: {
type: 'string',
label: 'Audience Name',
label: 'Audience Creation Name',
description: 'The name of the audience in Facebook.',
default: 'TODO: Model Name by default'
},
Expand All @@ -23,7 +24,7 @@ const action: ActionDefinition<Settings, Payload> = {
label: 'Existing Audience ID',
description: 'The ID of the audience in Facebook.',
dynamic: async (request, { settings }) => {
const fbClient = new FacebookClient(request, settings.adAccountId)
const fbClient = new FacebookClient(request, settings.retlAdAccountId)
const { choices, error } = await fbClient.getAllAudiences()

if (error) {
Expand Down Expand Up @@ -51,7 +52,7 @@ const action: ActionDefinition<Settings, Payload> = {
}
},
performHook: async (request, { settings, hookInputs }) => {
const fbClient = new FacebookClient(request, settings.adAccountId)
const fbClient = new FacebookClient(request, settings.retlAdAccountId)

if (hookInputs.existingAudienceId) {
const { data, error } = await fbClient.getSingleAudience(hookInputs.existingAudienceId)
Expand Down

0 comments on commit 3ea1444

Please sign in to comment.