@pipedream/google_ads 0.8.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +4 -4
  2. package/actions/add-contact-to-list-by-email/add-contact-to-list-by-email.mjs +2 -1
  3. package/actions/common/bidding.mjs +196 -0
  4. package/actions/common/conversion-upload.mjs +131 -0
  5. package/actions/common/props.mjs +1 -1
  6. package/actions/create-ad-group-report/create-ad-group-report.mjs +2 -2
  7. package/actions/create-ad-report/create-ad-report.mjs +2 -2
  8. package/actions/create-campaign-report/create-campaign-report.mjs +2 -2
  9. package/actions/create-customer-list/common-constants.mjs +10 -10
  10. package/actions/create-customer-list/create-customer-list.mjs +3 -3
  11. package/actions/create-customer-report/create-customer-report.mjs +2 -2
  12. package/actions/create-or-remove-campaign-criteria/create-or-remove-campaign-criteria.mjs +2 -2
  13. package/actions/create-or-remove-campaign-shared-set/create-or-remove-campaign-shared-set.mjs +2 -2
  14. package/actions/create-or-remove-shared-criteria/create-or-remove-shared-criteria.mjs +2 -2
  15. package/actions/create-or-update-ad-group/create-or-update-ad-group.mjs +2 -2
  16. package/actions/create-or-update-ad-group-ad/create-or-update-ad-group-ad.mjs +2 -2
  17. package/actions/create-or-update-bidding-strategy/create-or-update-bidding-strategy.mjs +7 -2
  18. package/actions/create-or-update-campaign/create-or-update-campaign.mjs +71 -14
  19. package/actions/create-or-update-campaign-budget/create-or-update-campaign-budget.mjs +2 -2
  20. package/actions/create-or-update-keywords/create-or-update-keywords.mjs +2 -2
  21. package/actions/create-or-update-shared-sets/create-or-update-shared-sets.mjs +2 -2
  22. package/actions/create-report/create-report.mjs +5 -7
  23. package/actions/create-responsive-search-ad/create-responsive-search-ad.mjs +2 -1
  24. package/actions/generate-keyword-ideas/generate-keyword-ideas.mjs +3 -3
  25. package/actions/get-keyword-quality-scores/get-keyword-quality-scores.mjs +3 -2
  26. package/actions/list-account-id-options/list-account-id-options.mjs +1 -1
  27. package/actions/list-ad-group-ads/list-ad-group-ads.mjs +2 -2
  28. package/actions/list-ad-group-criteria/list-ad-group-criteria.mjs +2 -2
  29. package/actions/list-ad-groups/list-ad-groups.mjs +2 -2
  30. package/actions/list-bidding-strategies/list-bidding-strategies.mjs +2 -2
  31. package/actions/list-campaign-budgets/list-campaign-budgets.mjs +2 -2
  32. package/actions/list-campaign-criteria/list-campaign-criteria.mjs +2 -2
  33. package/actions/list-campaign-shared-sets/list-campaign-shared-sets.mjs +2 -2
  34. package/actions/list-campaigns/list-campaigns.mjs +2 -2
  35. package/actions/list-customer-clients/list-customer-clients.mjs +2 -2
  36. package/actions/list-keywords/list-keywords.mjs +2 -2
  37. package/actions/list-shared-criteria/list-shared-criteria.mjs +2 -2
  38. package/actions/list-shared-sets/list-shared-sets.mjs +2 -2
  39. package/actions/send-offline-conversion/send-offline-conversion.mjs +4 -4
  40. package/actions/update-campaign-ai-max-settings/update-campaign-ai-max-settings.mjs +2 -1
  41. package/actions/upload-call-conversion/upload-call-conversion.mjs +65 -0
  42. package/actions/upload-click-conversion/upload-click-conversion.mjs +121 -0
  43. package/common/common-report.mjs +5 -7
  44. package/common/constants.mjs +108 -8
  45. package/common/resources/ad.mjs +25 -70
  46. package/common/resources/adGroup.mjs +2 -3
  47. package/common/resources/campaign.mjs +7 -10
  48. package/common/resources/customer.mjs +3 -4
  49. package/google_ads.app.mjs +79 -29
  50. package/package.json +1 -1
  51. package/sources/new-campaign-created/new-campaign-created.mjs +3 -3
  52. package/sources/new-lead-form-entry/new-lead-form-entry.mjs +3 -3
@@ -1,5 +1,7 @@
1
1
  import { axios } from "@pipedream/platform";
2
- import { CORE_DATE_SEGMENTS } from "./common/constants.mjs";
2
+ import {
3
+ API_VERSION, CORE_DATE_SEGMENTS,
4
+ } from "./common/constants.mjs";
3
5
  import { QUERIES } from "./common/queries.mjs";
4
6
  import {
5
7
  getResourceOption, sanitizeGaqlString,
@@ -32,25 +34,25 @@ export default {
32
34
  }) => ({
33
35
  label: name,
34
36
  value: id,
35
- }));
37
+ })) ?? [];
36
38
  },
37
39
  },
38
40
  accountId: {
39
41
  type: "string",
40
42
  label: "Use Google Ads As",
41
- description: "The ID of an account of a [customer directly accessible by the authenticated user](https://developers.google.com/google-ads/api/reference/rpc/v21/CustomerService/ListAccessibleCustomers?transport=rest). This is usually a Manager Account, used as `login-customer-id` (e.g., `1234567890`). Use the **List Account ID Options** action to get the list of accessible accounts.",
43
+ description: "The ID of an account of a [customer directly accessible by the authenticated user](https://developers.google.com/google-ads/api/reference/rpc/v25/CustomerService/ListAccessibleCustomers?transport=rest). This is usually a Manager Account, used as `login-customer-id` (e.g., `1234567890`). Use the **List Account ID Options** action to get the list of accessible accounts.",
42
44
  async options() {
43
45
  const response = await this.listAccessibleCustomers();
44
46
  return response?.map(((resourceName) => ({
45
47
  label: resourceName,
46
48
  value: resourceName.split("/").pop(),
47
- })));
49
+ }))) ?? [];
48
50
  },
49
51
  },
50
52
  customerClientId: {
51
53
  type: "string",
52
54
  label: "Managed Account",
53
- description: "The ID of a [customer client](https://developers.google.com/google-ads/api/reference/rpc/v21/CustomerClient) from the list of [customers linked to the selected account](https://developers.google.com/google-ads/api/docs/account-management/get-account-hierarchy) (e.g., `1234567890`). Use the **List Customer Clients** action to get the list of customer clients.",
55
+ description: "The ID of a [customer client](https://developers.google.com/google-ads/api/reference/rpc/v25/CustomerClient) from the list of [customers linked to the selected account](https://developers.google.com/google-ads/api/docs/account-management/get-account-hierarchy) (e.g., `1234567890`). Use the **List Customer Clients** action to get the list of customer clients.",
54
56
  useQuery: true,
55
57
  optional: true,
56
58
  async options({
@@ -69,7 +71,7 @@ export default {
69
71
  ? "[Manager] "
70
72
  : ""}${descriptiveName}`,
71
73
  value: id,
72
- })).filter(({ value }) => value !== accountId);
74
+ }))?.filter(({ value }) => value !== accountId) ?? [];
73
75
  },
74
76
  },
75
77
  reportResourceFilter: {
@@ -91,7 +93,7 @@ export default {
91
93
  query,
92
94
  pageToken,
93
95
  });
94
- const options = results?.map?.((item) => this.getResourceOption(item, resource));
96
+ const options = results?.map?.((item) => this.getResourceOption(item, resource)) ?? [];
95
97
  return {
96
98
  options,
97
99
  context: {
@@ -433,10 +435,44 @@ export default {
433
435
  };
434
436
  },
435
437
  },
438
+ conversionActionId: {
439
+ type: "string",
440
+ label: "Conversion Action",
441
+ description: "The conversion action to record this conversion against, as a resource name (e.g. `customers/1234567890/conversionActions/987654321`). Use a value returned by this selector. Must be an upload-type action (**Upload Clicks** for click conversions, **Upload Calls** for call conversions) - create one with the **Send Offline Conversion** action.",
442
+ async options({
443
+ accountId, customerClientId, prevContext,
444
+ }) {
445
+ const pageToken = prevContext?.nextPageToken;
446
+ const {
447
+ results, nextPageToken,
448
+ } = await this.search({
449
+ query: QUERIES.listConversionActions(),
450
+ accountId,
451
+ customerClientId,
452
+ params: {
453
+ pageToken,
454
+ },
455
+ });
456
+ const options = results?.map(({
457
+ conversionAction: {
458
+ resourceName, name,
459
+ },
460
+ }) => ({
461
+ label: name,
462
+ value: resourceName,
463
+ })) ?? [];
464
+ return {
465
+ options,
466
+ context: {
467
+ nextPageToken,
468
+ },
469
+ };
470
+ },
471
+ },
436
472
  leadFormId: {
437
473
  type: "string",
438
474
  label: "Lead Form ID",
439
- description: "Select a [Lead Form](https://developers.google.com/google-ads/api/reference/rpc/v21/LeadFormAsset) to watch for new entries.",
475
+ description: "Select a [Lead Form](https://developers.google.com/google-ads/api/reference/rpc/v25/LeadFormAsset) to watch for new entries.",
440
476
  async options({
441
477
  accountId, customerClientId,
442
478
  }) {
@@ -453,7 +489,7 @@ export default {
453
489
  }) => ({
454
490
  label: `${businessName} - ${headline}`,
455
491
  value: id,
456
- }));
492
+ })) ?? [];
457
493
  },
458
494
  },
459
495
  },
@@ -473,7 +509,7 @@ export default {
473
509
  }) {
474
510
  const data = {
475
511
  headers: this._headers(accountId),
476
- path: path.replace("{customerClientId}", customerClientId ?? accountId),
512
+ path: `/${API_VERSION}${path.replace("{customerClientId}", customerClientId ?? accountId)}`,
477
513
  ...opts,
478
514
  };
479
515
  return axios($, {
@@ -487,7 +523,7 @@ export default {
487
523
  }) {
488
524
  console.log("Executing query: ", query);
489
525
  const response = await this._makeRequest({
490
- path: "/v21/customers/{customerClientId}/googleAds:search",
526
+ path: "/customers/{customerClientId}/googleAds:search",
491
527
  method: "post",
492
528
  data: {
493
529
  query,
@@ -498,7 +534,7 @@ export default {
498
534
  },
499
535
  async listAccessibleCustomers() {
500
536
  const response = await this._makeRequest({
501
- path: "/v21/customers:listAccessibleCustomers",
537
+ path: "/customers:listAccessibleCustomers",
502
538
  });
503
539
  return response.resourceNames;
504
540
  },
@@ -517,7 +553,7 @@ export default {
517
553
  },
518
554
  async createUserList(args) {
519
555
  const response = await this._makeRequest({
520
- path: "/v21/customers/{customerClientId}/userLists:mutate",
556
+ path: "/customers/{customerClientId}/userLists:mutate",
521
557
  method: "post",
522
558
  ...args,
523
559
  });
@@ -582,25 +618,39 @@ export default {
582
618
  },
583
619
  async createConversionAction(args) {
584
620
  const response = await this._makeRequest({
585
- path: "/v21/customers/{customerClientId}/conversionActions:mutate",
621
+ path: "/customers/{customerClientId}/conversionActions:mutate",
586
622
  method: "post",
587
623
  ...args,
588
624
  });
589
625
  return response;
590
626
  },
627
+ async uploadClickConversions(opts = {}) {
628
+ return this._makeRequest({
629
+ method: "POST",
630
+ path: "/customers/{customerClientId}:uploadClickConversions",
631
+ ...opts,
632
+ });
633
+ },
634
+ async uploadCallConversions(opts = {}) {
635
+ return this._makeRequest({
636
+ method: "POST",
637
+ path: "/customers/{customerClientId}:uploadCallConversions",
638
+ ...opts,
639
+ });
640
+ },
591
641
  async addContactToCustomerList({
592
642
  path, ...opts
593
643
  }) {
594
644
  return this._makeRequest({
595
645
  method: "POST",
596
- path: `/v21/${path}:addOperations`,
646
+ path: `/${path}:addOperations`,
597
647
  ...opts,
598
648
  });
599
649
  },
600
650
  async createOfflineUserDataJob(opts = {}) {
601
651
  return this._makeRequest({
602
652
  method: "POST",
603
- path: "/v21/customers/{customerClientId}/offlineUserDataJobs:create",
653
+ path: "/customers/{customerClientId}/offlineUserDataJobs:create",
604
654
  ...opts,
605
655
  });
606
656
  },
@@ -609,28 +659,28 @@ export default {
609
659
  }) {
610
660
  return this._makeRequest({
611
661
  method: "POST",
612
- path: `/v21/${path}:run`,
662
+ path: `/${path}:run`,
613
663
  ...args,
614
664
  });
615
665
  },
616
666
  async generateKeywordIdeas(opts = {}) {
617
667
  return this._makeRequest({
618
668
  method: "POST",
619
- path: "/v22/customers/{customerClientId}:generateKeywordIdeas",
669
+ path: "/customers/{customerClientId}:generateKeywordIdeas",
620
670
  ...opts,
621
671
  });
622
672
  },
623
673
  async mutateCampaign(opts = {}) {
624
674
  return this._makeRequest({
625
675
  method: "POST",
626
- path: "/v21/customers/{customerClientId}/campaigns:mutate",
676
+ path: "/customers/{customerClientId}/campaigns:mutate",
627
677
  ...opts,
628
678
  });
629
679
  },
630
680
  async mutateAdGroup(opts = {}) {
631
681
  return this._makeRequest({
632
682
  method: "POST",
633
- path: "/v21/customers/{customerClientId}/adGroups:mutate",
683
+ path: "/customers/{customerClientId}/adGroups:mutate",
634
684
  ...opts,
635
685
  });
636
686
  },
@@ -641,7 +691,7 @@ export default {
641
691
  ? ` WHERE campaign.name LIKE '%${sanitizeGaqlString(query)}%'`
642
692
  : "";
643
693
  return this.search({
644
- query: `SELECT campaign.id, campaign.name, campaign.status, campaign.advertising_channel_type, campaign.start_date, campaign.end_date FROM campaign${filter}`,
694
+ query: `SELECT campaign.id, campaign.name, campaign.status, campaign.advertising_channel_type, campaign.start_date_time, campaign.end_date_time FROM campaign${filter}`,
645
695
  params: {
646
696
  pageToken,
647
697
  },
@@ -707,14 +757,14 @@ export default {
707
757
  async mutateAdGroupCriteria(opts = {}) {
708
758
  return this._makeRequest({
709
759
  method: "POST",
710
- path: "/v21/customers/{customerClientId}/adGroupCriteria:mutate",
760
+ path: "/customers/{customerClientId}/adGroupCriteria:mutate",
711
761
  ...opts,
712
762
  });
713
763
  },
714
764
  async mutateAdGroupAd(opts = {}) {
715
765
  return this._makeRequest({
716
766
  method: "POST",
717
- path: "/v21/customers/{customerClientId}/adGroupAds:mutate",
767
+ path: "/customers/{customerClientId}/adGroupAds:mutate",
718
768
  ...opts,
719
769
  });
720
770
  },
@@ -735,7 +785,7 @@ export default {
735
785
  async mutateSharedSets(opts = {}) {
736
786
  return this._makeRequest({
737
787
  method: "POST",
738
- path: "/v21/customers/{customerClientId}/sharedSets:mutate",
788
+ path: "/customers/{customerClientId}/sharedSets:mutate",
739
789
  ...opts,
740
790
  });
741
791
  },
@@ -756,7 +806,7 @@ export default {
756
806
  async mutateSharedCriteria(opts = {}) {
757
807
  return this._makeRequest({
758
808
  method: "POST",
759
- path: "/v21/customers/{customerClientId}/sharedCriteria:mutate",
809
+ path: "/customers/{customerClientId}/sharedCriteria:mutate",
760
810
  ...opts,
761
811
  });
762
812
  },
@@ -777,7 +827,7 @@ export default {
777
827
  async mutateCampaignSharedSets(opts = {}) {
778
828
  return this._makeRequest({
779
829
  method: "POST",
780
- path: "/v21/customers/{customerClientId}/campaignSharedSets:mutate",
830
+ path: "/customers/{customerClientId}/campaignSharedSets:mutate",
781
831
  ...opts,
782
832
  });
783
833
  },
@@ -826,7 +876,7 @@ export default {
826
876
  async mutateCampaignBudgets(opts = {}) {
827
877
  return this._makeRequest({
828
878
  method: "POST",
829
- path: "/v21/customers/{customerClientId}/campaignBudgets:mutate",
879
+ path: "/customers/{customerClientId}/campaignBudgets:mutate",
830
880
  ...opts,
831
881
  });
832
882
  },
@@ -847,7 +897,7 @@ export default {
847
897
  async mutateCampaignCriteria(opts = {}) {
848
898
  return this._makeRequest({
849
899
  method: "POST",
850
- path: "/v21/customers/{customerClientId}/campaignCriteria:mutate",
900
+ path: "/customers/{customerClientId}/campaignCriteria:mutate",
851
901
  ...opts,
852
902
  });
853
903
  },
@@ -882,7 +932,7 @@ export default {
882
932
  async mutateBiddingStrategies(opts = {}) {
883
933
  return this._makeRequest({
884
934
  method: "POST",
885
- path: "/v21/customers/{customerClientId}/biddingStrategies:mutate",
935
+ path: "/customers/{customerClientId}/biddingStrategies:mutate",
886
936
  ...opts,
887
937
  });
888
938
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/google_ads",
3
- "version": "0.8.0",
3
+ "version": "1.0.1",
4
4
  "description": "Pipedream Google Ads Components",
5
5
  "main": "google_ads.app.mjs",
6
6
  "keywords": [
@@ -6,8 +6,8 @@ export default {
6
6
  ...common,
7
7
  key: "google_ads-new-campaign-created",
8
8
  name: "New Campaign Created",
9
- description: "Emit new event when a new campaign is created. [See the documentation](https://developers.google.com/google-ads/api/reference/rpc/v21/GoogleAdsService/Search?transport=rest)",
10
- version: "0.0.9",
9
+ description: "Emit new event when a new campaign is created. [See the documentation](https://developers.google.com/google-ads/api/reference/rpc/v25/GoogleAdsService/Search?transport=rest)",
10
+ version: "0.1.0",
11
11
  type: "source",
12
12
  dedupe: "unique",
13
13
  sampleEmit,
@@ -19,7 +19,7 @@ export default {
19
19
  fields: {
20
20
  type: "string[]",
21
21
  label: "Extra Fields",
22
- description: "Additional [campaign fields](https://developers.google.com/google-ads/api/fields/v21/campaign) to emit in the event",
22
+ description: "Additional [campaign fields](https://developers.google.com/google-ads/api/fields/v25/campaign) to emit in the event",
23
23
  options: campaign.fields,
24
24
  optional: true,
25
25
  default: [
@@ -7,8 +7,8 @@ export default {
7
7
  ...common,
8
8
  key: "google_ads-new-lead-form-entry",
9
9
  name: "New Lead Form Entry",
10
- description: "Emit new event for new leads on a Lead Form. [See the documentation](https://developers.google.com/google-ads/api/reference/rpc/v21/GoogleAdsService/Search?transport=rest)",
11
- version: "0.0.9",
10
+ description: "Emit new event for new leads on a Lead Form. [See the documentation](https://developers.google.com/google-ads/api/reference/rpc/v25/GoogleAdsService/Search?transport=rest)",
11
+ version: "0.0.10",
12
12
  type: "source",
13
13
  dedupe: "unique",
14
14
  sampleEmit,
@@ -29,7 +29,7 @@ export default {
29
29
  docsAlert: {
30
30
  type: "alert",
31
31
  alertType: "info",
32
- content: "If needed, see Google's documentation on [submission fields](https://developers.google.com/google-ads/api/reference/rpc/v21/LeadFormSubmissionField) and [custom submission fields](https://developers.google.com/google-ads/api/reference/rpc/v21/CustomLeadFormSubmissionField).",
32
+ content: "If needed, see Google's documentation on [submission fields](https://developers.google.com/google-ads/api/reference/rpc/v25/LeadFormSubmissionField) and [custom submission fields](https://developers.google.com/google-ads/api/reference/rpc/v25/CustomLeadFormSubmissionField).",
33
33
  },
34
34
  },
35
35
  methods: {