Skip to content

Commit 89cb048

Browse files
authored
New Components - adyntel (#16231)
* new components * pnpm-lock.yaml * pnpm-lock.yaml
1 parent ecaedb2 commit 89cb048

File tree

6 files changed

+167
-7
lines changed

6 files changed

+167
-7
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import adyntel from "../../adyntel.app.mjs";
2+
3+
export default {
4+
key: "adyntel-google-ads-by-company",
5+
name: "Get Google Ads by Company",
6+
description: "Retrieve all Google ads for a given company domain. [See the documentation](https://docs.adyntel.com/ad-libraries/google)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
adyntel,
11+
companyDomain: {
12+
type: "string",
13+
label: "Company Domain",
14+
description: "The company domain. Company domain has to be passed in the 'company.com' format, meaning all prefixes like 'https://' or 'www.' need to be removed.",
15+
},
16+
mediaType: {
17+
type: "string",
18+
label: "Media Type",
19+
description: "Filter results based on media type",
20+
options: [
21+
"text",
22+
"image",
23+
"video",
24+
],
25+
optional: true,
26+
},
27+
},
28+
async run({ $ }) {
29+
const response = await this.adyntel.getGoogleAds({
30+
$,
31+
data: {
32+
company_domain: this.companyDomain,
33+
media_type: this.mediaType,
34+
},
35+
});
36+
$.export("$summary", `Fetched Google Ads for domain ${this.companyDomain}`);
37+
return response;
38+
},
39+
};
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import adyntel from "../../adyntel.app.mjs";
2+
3+
export default {
4+
key: "adyntel-meta-ad-search",
5+
name: "Meta Ad Search",
6+
description: "Searches the Meta ad library. [See the documentation](https://docs.adyntel.com/ad-libraries/meta-ad-search)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
adyntel,
11+
keyword: {
12+
propDefinition: [
13+
adyntel,
14+
"keyword",
15+
],
16+
},
17+
countryCode: {
18+
propDefinition: [
19+
adyntel,
20+
"countryCode",
21+
],
22+
},
23+
},
24+
async run({ $ }) {
25+
const response = await this.adyntel.metaAdSearch({
26+
$,
27+
data: {
28+
keyword: this.keyword,
29+
country_code: this.countryCode,
30+
},
31+
});
32+
$.export("$summary", `Successfully performed Meta ad search with keyword: \`${this.keyword}\`${this.countryCode
33+
? ` and country code: \`${this.countryCode}\``
34+
: ""}`);
35+
return response;
36+
},
37+
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import adyntel from "../../adyntel.app.mjs";
2+
3+
export default {
4+
key: "adyntel-tiktok-search",
5+
name: "Search TikTok Ads",
6+
description: "Search TikTok ads using a keyword. [See the documentation](https://docs.adyntel.com/ad-libraries/tiktok-search)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
adyntel,
11+
keyword: {
12+
propDefinition: [
13+
adyntel,
14+
"keyword",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.adyntel.getTiktokAds({
20+
$,
21+
data: {
22+
keyword: this.keyword,
23+
},
24+
});
25+
$.export("$summary", `Successfully retrieved TikTok ads for keyword: \`${this.keyword}\``);
26+
return response;
27+
},
28+
};

components/adyntel/adyntel.app.mjs

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,60 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "adyntel",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
keyword: {
8+
type: "string",
9+
label: "Keyword",
10+
description: "The keyword to search by",
11+
},
12+
countryCode: {
13+
type: "string",
14+
label: "Country Code",
15+
description: "Use if you want to limit the search to only one country. E.g. `US`",
16+
optional: true,
17+
},
18+
},
519
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
20+
_baseUrl() {
21+
return "https://api.adyntel.com";
22+
},
23+
_makeRequest({
24+
$ = this,
25+
method = "POST",
26+
path = "/",
27+
data = {},
28+
...otherOpts
29+
}) {
30+
return axios($, {
31+
...otherOpts,
32+
method,
33+
url: `${this._baseUrl()}${path}`,
34+
data: {
35+
...data,
36+
api_key: this.$auth.api_key,
37+
email: this.$auth.username,
38+
},
39+
});
40+
},
41+
metaAdSearch(opts = {}) {
42+
return this._makeRequest({
43+
path: "/facebook_ad_search",
44+
...opts,
45+
});
46+
},
47+
getGoogleAds(opts = {}) {
48+
return this._makeRequest({
49+
path: "/google",
50+
...opts,
51+
});
52+
},
53+
getTiktokAds(opts = {}) {
54+
return this._makeRequest({
55+
path: "/tiktok_search",
56+
...opts,
57+
});
958
},
1059
},
1160
};

components/adyntel/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/adyntel",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream Adyntel Components",
55
"main": "adyntel.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.3"
1417
}
15-
}
18+
}

pnpm-lock.yaml

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)