Skip to content

Commit dfabdb3

Browse files
committed
generate-keyword-ideas
1 parent 31fd0e0 commit dfabdb3

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import common from "../common/common.mjs";
2+
import { getAdditionalFields } from "../common/props.mjs";
3+
import {
4+
parseObject, parseStringObject,
5+
} from "../../common/utils.mjs";
6+
const docLink = "https://developers.google.com/google-ads/api/reference/rpc/v22/KeywordPlanIdeaService/GenerateKeywordIdeas?transport=rest";
7+
8+
export default {
9+
key: "google-ads-generate-keyword-ideas",
10+
name: "Generate Keyword Ideas",
11+
description: `Generate keyword ideas using the Google Ads API. [See the documentation](${docLink})`,
12+
version: "0.0.1",
13+
type: "action",
14+
annotations: {
15+
destructiveHint: false,
16+
openWorldHint: true,
17+
readOnlyHint: true,
18+
},
19+
props: {
20+
...common.props,
21+
additionalFields: getAdditionalFields(docLink),
22+
},
23+
async run({ $ }) {
24+
const additionalFields = parseObject(parseStringObject(this.additionalFields));
25+
const response = await this.googleAds.generateKeywordIdeas({
26+
$,
27+
accountId: this.accountId,
28+
customerClientId: this.customerClientId,
29+
data: {
30+
...additionalFields,
31+
},
32+
});
33+
$.export("$summary", "Successfully generated keyword ideas.");
34+
return response;
35+
},
36+
};

components/google_ads/google_ads.app.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,5 +247,12 @@ export default {
247247
...args,
248248
});
249249
},
250+
async generateKeywordIdeas(opts = {}) {
251+
return this._makeRequest({
252+
method: "POST",
253+
path: "/v22/customers/{customerClientId}:generateKeywordIdeas",
254+
...opts,
255+
});
256+
},
250257
},
251258
};

0 commit comments

Comments
 (0)