Skip to content

Commit

Permalink
fix(Facebook Lead Ads Trigger Node): Fix issue with optional fields (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Joffcom authored Nov 13, 2024
1 parent b22142d commit 70d315b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,10 @@ export class FacebookLeadAdsTrigger implements INodeType {
return {
id: lead.id,
data: lead.field_data.reduce(
(acc, field) => ({ ...acc, [field.name]: field.values[0] }),
(acc, field) => ({
...acc,
[field.name]: field.values && field.values.length > 0 ? field.values[0] : null,
}),
{},
),
form: {
Expand Down
6 changes: 3 additions & 3 deletions packages/nodes-base/nodes/FacebookLeadAds/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function facebookApiRequest(
qs,
body,
gzip: true,
uri: `https://graph.facebook.com/v17.0${resource}`,
uri: `https://graph.facebook.com/v21.0${resource}`,
json: true,
};

Expand Down Expand Up @@ -89,7 +89,7 @@ export async function facebookAppApiRequest(
method,
qs,
gzip: true,
uri: `https://graph.facebook.com/v17.0${resource}`,
uri: `https://graph.facebook.com/v21.0${resource}`,
json: true,
};

Expand Down Expand Up @@ -181,7 +181,7 @@ export async function facebookPageApiRequest(
qs,
body,
gzip: true,
uri: `https://graph.facebook.com/v17.0${resource}`,
uri: `https://graph.facebook.com/v21.0${resource}`,
json: true,
};

Expand Down

0 comments on commit 70d315b

Please sign in to comment.