Skip to content

Commit

Permalink
correcting reddit oauth to managed (#2453)
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-ayoub-segment authored Sep 25, 2024
1 parent cae15b2 commit 211354c
Showing 1 changed file with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const destination: AudienceDestinationDefinition<Settings, AudienceSettings> = {
slug: 'actions-reddit-audiences',
mode: 'cloud',
authentication: {
scheme: 'oauth2',
scheme: 'oauth-managed',
fields: {
ad_account_id: {
type: 'string',
Expand Down Expand Up @@ -53,20 +53,23 @@ const destination: AudienceDestinationDefinition<Settings, AudienceSettings> = {
full_audience_sync: false
},
async createAudience(request, createAudienceInput) {
const response = await request<CreateAudienceResp>(`https://ads-api.reddit.com/api/v3/ad_accounts/${createAudienceInput.settings.ad_account_id}/custom_audiences`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
json: {
data: {
name: createAudienceInput.audienceName,
type: 'CUSTOMER_LIST'
}
} as CreateAudienceReq
})
const response = await request<CreateAudienceResp>(
`https://ads-api.reddit.com/api/v3/ad_accounts/${createAudienceInput.settings.ad_account_id}/custom_audiences`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
json: {
data: {
name: createAudienceInput.audienceName,
type: 'CUSTOMER_LIST'
}
} as CreateAudienceReq
}
)
const jsonOutput = await response.json()
return { externalId: (jsonOutput.data.id) }
return { externalId: jsonOutput.data.id }
},
async getAudience(_, getAudienceInput) {
return {
Expand Down

0 comments on commit 211354c

Please sign in to comment.