Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import app from "../../dataforseo.app.mjs";

export default {
key: "dataforseo-get-business-listings",
name: "Get Business Listings",
description: "Get Business Listings. [See the documentation](https://docs.dataforseo.com/v3/business_data/business_listings/search/live/?bash)",
version: "0.0.1",
type: "action",
props: {
app,
locationCoordinate: {
propDefinition: [
app,
"locationCoordinate",
],
},
categories: {
propDefinition: [
app,
"categories",
],
},
title: {
propDefinition: [
app,
"title",
],
},
description: {
propDefinition: [
app,
"description",
],
},
isClaimed: {
propDefinition: [
app,
"isClaimed",
],
},
limit: {
propDefinition: [
app,
"limit",
],
},
},
async run({ $ }) {
const response = await this.app.getBusinessListings({
$,
data: [
{
location_coordinate: this.locationCoordinate,
categories: this.categories,
description: this.description,
title: this.title,
is_claimed: this.isClaimed,
limit: this.limit,
},
],
});
$.export("$summary", `Successfully sent the request. Status: ${response.tasks[0].status_message}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import app from "../../dataforseo.app.mjs";

export default {
key: "dataforseo-get-keyword-difficulty",
name: "Get Keyword Difficulty",
description: "Get Keyword Difficulty. [See the documentation](https://docs.dataforseo.com/v3/dataforseo_labs/google/bulk_keyword_difficulty/live/?bash)",
version: "0.0.1",
type: "action",
props: {
app,
languageCode: {
propDefinition: [
app,
"languageCode",
],
},
locationCode: {
propDefinition: [
app,
"locationCode",
],
},
keywords: {
propDefinition: [
app,
"keywords",
],
},
},
async run({ $ }) {
const response = await this.app.getKeywordDifficulty({
$,
data: [
{
language_code: this.languageCode,
location_code: this.locationCode,
keywords: this.keywords,
},
],
});
$.export("$summary", `Successfully sent the request. Status: ${response.tasks[0].status_message}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import app from "../../dataforseo.app.mjs";

export default {
key: "dataforseo-get-ranked-keywords",
name: "Get Ranked Keywords",
description: "Description for get-ranked-keywords. [See the documentation](https://docs.dataforseo.com/v3/keywords_data/google_ads/keywords_for_site/task_post/?bash)",
version: "0.0.1",
type: "action",
props: {
app,
locationCode: {
propDefinition: [
app,
"locationCode",
],
},
targetType: {
propDefinition: [
app,
"targetType",
],
},
target: {
propDefinition: [
app,
"target",
],
},
},
async run({ $ }) {
const response = await this.app.getRankedKeywords({
$,
data: [
{
location_code: this.locationCode,
target_type: this.targetType,
target: this.target,
},
],
});
$.export("$summary", `Successfully sent the request. Status: ${response.tasks[0].status_message}`);
return response;
},
};
6 changes: 6 additions & 0 deletions components/dataforseo/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
TARGET_TYPES: [
"site",
"page",
],
};
142 changes: 137 additions & 5 deletions components/dataforseo/dataforseo.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,143 @@
import { axios } from "@pipedream/platform";
import constants from "./common/constants.mjs";

export default {
type: "app",
app: "dataforseo",
propDefinitions: {},
propDefinitions: {
locationCode: {
type: "string",
label: "Location Code",
description: "The code of the target location",
async options() {
const response = await this.getLocations();
const languageCodes = response.tasks[0].result;
return languageCodes.map(({
location_name, location_code,
}) => ({
value: location_code,
label: location_name,
}));
},
},
locationCoordinate: {
type: "string",
label: "Location Coordinate",
description: "The coordinate of the target location. It should be specified in the “latitude,longitude,radius” format, i.e.: `53.476225,-2.243572,200`",
},
targetType: {
type: "string",
label: "Target Type",
description: "The type of the target",
options: constants.TARGET_TYPES,
},
target: {
type: "string",
label: "Target",
description: "The domain name or the url of the target website or page",
},
categories: {
type: "string[]",
label: "Categories",
description: "The categories you specify are used to search for business listings",
optional: true,
},
description: {
type: "string",
label: "Description",
description: "The description of the business entity for which the results are collected",
optional: true,
},
title: {
type: "string",
label: "Title",
description: "The name of the business entity for which the results are collected",
optional: true,
},
isClaimed: {
type: "boolean",
label: "Is Claimed",
description: "Indicates whether the business is verified by its owner on Google Maps",
optional: true,
},
limit: {
type: "string",
label: "Limit",
description: "The maximum number of returned businesses",
optional: true,
},
languageCode: {
type: "string",
label: "Language Code",
description: "The language code for the request",
async options() {
const response = await this.getLanguageCode();
const languageCodes = response.tasks[0].result;
return languageCodes.map(({
language_name, language_code,
}) => ({
value: language_code,
label: language_name,
}));
},
},
keywords: {
type: "string[]",
label: "Keywords",
description: "Target Keywords. The maximum number of keywords is 1000",
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://api.dataforseo.com/v3";
},
async _makeRequest(opts = {}) {
const {
$ = this,
path,
...otherOpts
} = opts;
return axios($, {
...otherOpts,
url: this._baseUrl() + path,
auth: {
username: `${this.$auth.api_login}`,
password: `${this.$auth.api_password}`,
},
});
},
async getKeywordDifficulty(args = {}) {
return this._makeRequest({
path: "/dataforseo_labs/google/bulk_keyword_difficulty/live",
method: "post",
...args,
});
},
async getBusinessListings(args = {}) {
return this._makeRequest({
path: "/business_data/business_listings/search/live",
method: "post",
...args,
});
},
async getRankedKeywords(args = {}) {
return this._makeRequest({
path: "/keywords_data/google_ads/keywords_for_site/live",
method: "post",
...args,
});
},
async getLanguageCode(args = {}) {
return this._makeRequest({
path: "/keywords_data/google_ads/languages",
...args,
});
},
async getLocations(args = {}) {
return this._makeRequest({
path: "/serp/google/ads_search/locations",
...args,
});
},
},
};
};
7 changes: 5 additions & 2 deletions components/dataforseo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/dataforseo",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream DataForSEO Components",
"main": "dataforseo.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3"
}
}
}
6 changes: 5 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading