Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: onboard facebook custom audience to transformer proxy #2769

Merged
merged 15 commits into from
Oct 30, 2023
Merged
6 changes: 6 additions & 0 deletions src/v0/destinations/fb_custom_audience/networkhandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const { networkHandler, errorResponseHandler } = require('../../util/facebookUtils/networkHandler');

module.exports = {
networkHandler,
errorResponseHandler,
};
46 changes: 45 additions & 1 deletion src/v0/util/facebookUtils/networkHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const errorDetailsMap = {
33: new ErrorDetailsExtractorBuilder()
.setStatus(400)
.setMessage(
"Object with ID 'PIXEL_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation",
"Object with ID 'PIXEL_ID' / 'DATASET_ID' / 'AUDIENCE_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation",
)
.build(),
default: new ErrorDetailsExtractorBuilder()
Expand Down Expand Up @@ -151,6 +151,50 @@ const errorDetailsMap = {
.setMessage('API User Too Many Calls')
.build(),
},
shrouti1507 marked this conversation as resolved.
Show resolved Hide resolved
// facebook custom audience related error codes
// ref:
// https://developers.facebook.com/docs/marketing-api/reference/custom-audience/#error-codes-4
// https://developers.facebook.com/docs/marketing-api/error-reference/
294: {
default: new ErrorDetailsExtractorBuilder()
.setStatus(400)
.setMessage(
'Missing permission. Please make sure you have ads_management permission and the application is included in the allowlist',
)
.build(),
},
1487301: {
default: new ErrorDetailsExtractorBuilder()
.setStatus(400)
.setMessage(
'Custom Audience Unavailable: The custom audience you are trying to use has not been shared with your ad account',
)
.build(),
},
1487366: {
default: new ErrorDetailsExtractorBuilder()
.setStatus(400)
.setMessage('Custom Audience Has Been Deleted')
.build(),
},
2650: {
default: new ErrorDetailsExtractorBuilder()
.setStatus(400)
.setMessage('Failed to update the custom audience')
.build(),
},
105: {
default: new ErrorDetailsExtractorBuilder()
.setStatus(400)
.setMessage('The number of parameters exceeded the maximum for this operation')
.build(),
},
80003: {
default: new ErrorDetailsExtractorBuilder()
.setStatus(429)
.setMessage('There have been too many calls to this ad-account.')
.build(),
},
};

const getErrorDetailsFromErrorMap = (error) => {
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/data/facebook_pixel_proxy_output.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
{
"output": {
"status": 400,
"message": "Object with ID 'PIXEL_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation",
"message": "Object with ID 'PIXEL_ID' / 'DATASET_ID' / 'AUDIENCE_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation",
"destinationResponse": {
"error": {
"message": "Unsupported post request. Object with ID '1234567891234569' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/data/fb_proxy_output.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
{
"output": {
"status": 400,
"message": "Object with ID 'PIXEL_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation",
"message": "Object with ID 'PIXEL_ID' / 'DATASET_ID' / 'AUDIENCE_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation",
"destinationResponse": {
"error": {
"message": "Unsupported post request. Object with ID '1234567891234569' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export const data = [
output: {
status: 400,
message:
"Object with ID 'PIXEL_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation",
"Object with ID 'PIXEL_ID' / 'DATASET_ID' / 'AUDIENCE_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation",
destinationResponse: {
error: {
message:
Expand Down
2 changes: 1 addition & 1 deletion test/integrations/destinations/fb/dataDelivery/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export const data = [
"body": {
"output": {
"status": 400,
"message": "Object with ID 'PIXEL_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation",
"message": "Object with ID 'PIXEL_ID' / 'DATASET_ID' / 'AUDIENCE_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation",
"destinationResponse": {
"error": {
"message": "Unsupported post request. Object with ID '1234567891234569' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
Expand Down
Loading
Loading