@pipedream/linkedin_ads 0.1.0 → 0.3.0

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.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # Overview
2
+
3
+ The LinkedIn Ads API on Pipedream enables you to automate and integrate your LinkedIn advertising efforts with other services. Fetch campaign data, manage ad accounts, or automate ad creation and adjustments. With Pipedream, you can trigger workflows with HTTP requests, emails, and on a schedule, and connect to thousands of other apps with minimal effort.
4
+
5
+ # Example Use Cases
6
+
7
+ - **Sync LinkedIn Ad Campaigns to Google Sheets**: Automate the syncing of LinkedIn Ad campaign data into a Google Sheets spreadsheet. This workflow makes it easy to analyze ad performance, share reports with your team, and maintain records without manual data entry.
8
+
9
+ - **LinkedIn Ad Performance Alerts via Slack or Email**: Set up a workflow that monitors your LinkedIn Ad campaigns for key performance metrics, and sends an alert via Slack or Email when your ads meet certain criteria, such as cost per click (CPC) thresholds or impressions goals, ensuring prompt reaction to ad performance.
10
+
11
+ - **Automatic Ad Pausing Based on Budget Constraints**: Create a workflow that checks your LinkedIn Ad spend against your set budget and automatically pauses campaigns if spend exceeds your budget. This helps maintain control over your advertising costs without needing to check in manually.
@@ -1,4 +1,5 @@
1
1
  import app from "../linkedin/linkedin.app.mjs";
2
+ import utils from "./common/utils.mjs";
2
3
 
3
4
  export default {
4
5
  ...app,
@@ -71,6 +72,83 @@ export default {
71
72
  }));
72
73
  },
73
74
  },
75
+ eventId: {
76
+ type: "string",
77
+ label: "Event ID",
78
+ description: "The ID of the event to retrieve registrations for.",
79
+ async options({
80
+ organizationId, page,
81
+ }) {
82
+ if (!organizationId) {
83
+ return [];
84
+ }
85
+ const count = 20;
86
+ const { elements } = await this.searchEvents({
87
+ params: {
88
+ q: "organizerLeadGenFormEnabledEvents",
89
+ organizer: this.getOrganizationUrn(organizationId),
90
+ count,
91
+ start: page * count,
92
+ },
93
+ });
94
+ return elements?.map(({
95
+ id: value, localizedName: label,
96
+ }) => ({
97
+ label,
98
+ value,
99
+ }));
100
+ },
101
+ },
102
+ conversionId: {
103
+ type: "string",
104
+ label: "Conversion ID",
105
+ description: "The ID of the conversion event.",
106
+ async options({
107
+ adAccountId, page,
108
+ }) {
109
+ const count = 20;
110
+ const { elements } = await this.searchConversions({
111
+ params: {
112
+ q: "account",
113
+ account: this.getSponsoredAccountUrn(adAccountId),
114
+ count,
115
+ start: page * count,
116
+ },
117
+ });
118
+ return elements?.map(({
119
+ id: value, name: label,
120
+ }) => ({
121
+ label,
122
+ value,
123
+ }));
124
+ },
125
+ },
126
+ leadFormId: {
127
+ type: "string",
128
+ label: "Lead Form ID",
129
+ description: "Select the lead form to retrieve responses for.",
130
+ async options({
131
+ page, adAccountId,
132
+ }) {
133
+ const count = 20;
134
+ const { elements } = await this.searchLeadForms({
135
+ debug: true,
136
+ params: {
137
+ q: "owner",
138
+ owner: `(sponsoredAccount:${this.getSponsoredAccountUrn(adAccountId)})`,
139
+ count,
140
+ start: page * count,
141
+ },
142
+ });
143
+ return elements.map(({
144
+ id,
145
+ name: label,
146
+ }) => ({
147
+ label,
148
+ value: String(id),
149
+ }));
150
+ },
151
+ },
74
152
  },
75
153
  methods: {
76
154
  ...app.methods,
@@ -80,6 +158,18 @@ export default {
80
158
  getSponsoredCampaignUrn(id) {
81
159
  return `urn:li:sponsoredCampaign:${id}`;
82
160
  },
161
+ getOrganizationUrn(id) {
162
+ return `urn:li:organization:${id}`;
163
+ },
164
+ getConversionUrn(id) {
165
+ return `urn:lla:llaPartnerConversion:${id}`;
166
+ },
167
+ getEventUrn(id) {
168
+ return `urn:li:event:${id}`;
169
+ },
170
+ getVersionedLeadGenFormUrn(id, version = 1) {
171
+ return `urn:li:versionedLeadGenForm:(urn:li:leadGenForm:${id},${version})`;
172
+ },
83
173
  searchCampaigns({
84
174
  adAccountId, ...args
85
175
  } = {}) {
@@ -88,5 +178,57 @@ export default {
88
178
  ...args,
89
179
  });
90
180
  },
181
+ searchLeadForms(args = {}) {
182
+ const keys = [
183
+ "owner",
184
+ ];
185
+ return this._makeRequest({
186
+ path: "/leadForms",
187
+ paramsSerializer: utils.getParamsSerializer(utils.encodeParamKeys(keys)),
188
+ ...args,
189
+ });
190
+ },
191
+ getLeadForm({
192
+ leadFormId, ...args
193
+ } = {}) {
194
+ return this._makeRequest({
195
+ debug: true,
196
+ path: `/leadForms/${leadFormId}`,
197
+ ...args,
198
+ });
199
+ },
200
+ searchEvents(args = {}) {
201
+ const keys = [
202
+ "organizer",
203
+ ];
204
+ return this._makeRequest({
205
+ debug: true,
206
+ path: "/events",
207
+ paramsSerializer: utils.getParamsSerializer(utils.encodeParamKeys(keys)),
208
+ transformResponse: utils.transformResponse,
209
+ ...args,
210
+ });
211
+ },
212
+ searchConversions(args = {}) {
213
+ return this._makeRequest({
214
+ debug: true,
215
+ path: "/conversions",
216
+ paramsSerializer: utils.getParamsSerializer(utils.encodeFn),
217
+ ...args,
218
+ });
219
+ },
220
+ searchLeadFormResponses(args = {}) {
221
+ const keys = [
222
+ "owner",
223
+ "versionedLeadGenFormUrn",
224
+ "associatedEntity",
225
+ ];
226
+ return this._makeRequest({
227
+ debug: true,
228
+ path: "/leadFormResponses",
229
+ paramsSerializer: utils.getParamsSerializer(utils.encodeParamKeys(keys)),
230
+ ...args,
231
+ });
232
+ },
91
233
  },
92
234
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/linkedin_ads",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Pipedream LinkedIn Ads Components",
5
5
  "main": "linkedin_ads.app.mjs",
6
6
  "keywords": [