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
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Add Contacts to Sequence",
description: "Adds one or more contacts to a sequence in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#add-contacts-to-sequence)",
type: "action",
version: "0.0.4",
version: "0.0.5",
props: {
app,
sequenceId: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Create Account",
description: "Creates a new account in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#create-an-account)",
type: "action",
version: "0.0.4",
version: "0.0.5",
props: {
app,
name: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Create Contact",
description: "Creates a new contact in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#create-a-contact)",
type: "action",
version: "0.0.5",
version: "0.0.6",
props: {
app,
email: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Create Opportunity",
description: "Creates a new opportunity in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#create-opportunity)",
type: "action",
version: "0.0.3",
version: "0.0.4",
props: {
app,
ownerId: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "Create Or Update Contact",
description: "Creates or updates a specific contact. If the contact email already exists, it's updated. Otherwise, a new contact is created. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#create-a-contact)",
type: "action",
version: "0.0.2",
version: "0.0.3",
props: {
app,
email: {
Expand Down Expand Up @@ -88,7 +88,7 @@ export default {
direct_phone: this.phone,
});

const { contacts } = await this.app.listContacts({
const { contacts } = await this.app.searchContacts({
params: {
q_keywords: this.email,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Get Opportunity",
description: "Gets a specific opportunity in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#view-opportunity)",
type: "action",
version: "0.0.3",
version: "0.0.4",
props: {
app,
opportunityId: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "People Enrichment",
description: "Enriches a person's information, the more information you pass in, the more likely we can find a match. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#people-enrichment)",
type: "action",
version: "0.0.6",
version: "0.0.7",
props: {
app,
firstName: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "Search For Accounts",
description: "Search for accounts in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-accounts)",
type: "action",
version: "0.0.3",
version: "0.0.4",
props: {
app,
search: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "Search For Contacts",
description: "Search for contacts in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-contacts)",
type: "action",
version: "0.0.3",
version: "0.0.4",
props: {
app,
search: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "Search For Sequences",
description: "Search for sequences in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-sequences)",
type: "action",
version: "0.0.3",
version: "0.0.4",
props: {
app,
search: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Update Account Stage",
description: "Updates the stage of one or more accounts in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#update-account-stage)",
type: "action",
version: "0.0.4",
version: "0.0.5",
props: {
app,
accountIds: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "Update Account",
description: "Updates an existing account in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#update-an-account)",
type: "action",
version: "0.0.4",
version: "0.0.5",
props: {
app,
accountId: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Update Contact Stage",
description: "Updates the stage of one or more contacts in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#update-contact-stage)",
type: "action",
version: "0.0.4",
version: "0.0.5",
props: {
app,
contactIds: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "Update Contact",
description: "Updates an existing contact in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#update-a-contact)",
type: "action",
version: "0.0.5",
version: "0.0.6",
props: {
app,
contactId: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Update Opportunity",
description: "Updates a new opportunity in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#update-opportunity)",
type: "action",
version: "0.0.3",
version: "0.0.4",
props: {
app,
opportunityId: {
Expand Down
57 changes: 29 additions & 28 deletions components/apollo_io/apollo_io.app.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { axios } from "@pipedream/platform";
import constants from "./common/constants.mjs";
import utils from "./common/utils.mjs";

export default {
type: "app",
Expand All @@ -10,7 +11,7 @@ export default {
label: "Account ID",
description: "Identifier of the account for this contact",
async options({ page }) {
const { accounts } = await this.listAccounts({
const { accounts } = await this.searchAccounts({
params: {
page: page + 1,
},
Expand All @@ -28,7 +29,7 @@ export default {
label: "Contact ID",
description: "Identifier of the contact to update",
async options({ page }) {
const { contacts } = await this.listContacts({
const { contacts } = await this.searchContacts({
params: {
page: page + 1,
},
Expand Down Expand Up @@ -243,15 +244,15 @@ export default {
...args,
});
},
listAccounts(args = {}) {
put(args = {}) {
return this.makeRequest({
path: "/accounts/search",
method: "put",
...args,
});
},
listContacts(args = {}) {
patch(args = {}) {
return this.makeRequest({
path: "/contacts/search",
method: "patch",
...args,
});
},
Expand All @@ -268,7 +269,7 @@ export default {
});
},
listSequences(args = {}) {
return this.makeRequest({
return this.post({
path: "/emailer_campaigns/search",
...args,
});
Expand Down Expand Up @@ -298,47 +299,41 @@ export default {
});
},
createContact(args = {}) {
return this.makeRequest({
method: "POST",
return this.post({
path: "/contacts",
...args,
});
},
updateContact({
contactId, ...args
}) {
return this.makeRequest({
method: "PUT",
return this.put({
path: `/contacts/${contactId}`,
...args,
});
},
updateContactStage(args = {}) {
return this.makeRequest({
method: "POST",
return this.post({
path: "/contacts/update_stages",
...args,
});
},
createAccount(args = {}) {
return this.makeRequest({
method: "POST",
return this.post({
path: "/accounts",
...args,
});
},
createOpportunity(args = {}) {
return this.makeRequest({
method: "POST",
return this.post({
path: "/opportunities",
...args,
});
},
updateOpportunity({
opportunityId, ...args
}) {
return this.makeRequest({
method: "PATCH",
return this.patch({
path: `/opportunities/${opportunityId}`,
...args,
});
Expand All @@ -354,36 +349,33 @@ export default {
updateAccount({
accountId, ...args
}) {
return this.makeRequest({
method: "PUT",
return this.put({
path: `/accounts/${accountId}`,
...args,
});
},
updateAccountStage(args = {}) {
return this.makeRequest({
method: "POST",
return this.post({
path: "/accounts/bulk_update",
...args,
});
},
addContactsToSequence({
sequenceId, ...args
}) {
return this.makeRequest({
method: "POST",
return this.post({
path: `/emailer_campaigns/${sequenceId}/add_contact_ids`,
...args,
});
},
searchAccounts(args = {}) {
return this.makeRequest({
return this.post({
path: "/accounts/search",
...args,
});
},
searchContacts(args = {}) {
return this.makeRequest({
return this.post({
path: "/contacts/search",
...args,
});
Expand All @@ -394,7 +386,7 @@ export default {
...args,
});
},
async *getResourcesStream({
async *getIterations({
resourceFn,
resourceFnArgs,
resourceName,
Expand All @@ -409,6 +401,7 @@ export default {
...resourceFnArgs,
params: {
...resourceFnArgs.params,
per_page: constants.DEFAULT_LIMIT,
page,
},
});
Expand All @@ -429,8 +422,16 @@ export default {
}
}

if (nextResources.length < constants.DEFAULT_LIMIT) {
console.log("No next page");
return;
}

page += 1;
}
},
paginate(args = {}) {
return utils.iterate(this.getIterations(args));
},
},
};
4 changes: 3 additions & 1 deletion components/apollo_io/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
const BASE_URL = "https://api.apollo.io";
const VERSION_PATH = "/v1";
const VERSION_PATH = "/api/v1";
const DEFAULT_LIMIT = 100;
const DEFAULT_MAX = 600;

export default {
BASE_URL,
VERSION_PATH,
DEFAULT_LIMIT,
DEFAULT_MAX,
};
12 changes: 6 additions & 6 deletions components/apollo_io/common/utils.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
async function streamIterator(stream) {
const resources = [];
for await (const resource of stream) {
resources.push(resource);
async function iterate(iterations) {
const items = [];
for await (const item of iterations) {
items.push(item);
}
return resources;
return items;
}

function cleanObject(o) {
Expand All @@ -16,6 +16,6 @@ function cleanObject(o) {
}

export default {
streamIterator,
iterate,
cleanObject,
};
2 changes: 1 addition & 1 deletion components/apollo_io/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/apollo_io",
"version": "0.5.0",
"version": "0.5.1",
"description": "Pipedream Apollo.io Components",
"main": "apollo_io.app.mjs",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import common from "../common/polling.mjs";
export default {
...common,
key: "apollo_io-account-created",
name: "Account Created",
description: "Triggers when an account is created. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-accounts)",
name: "New Account Created",
description: "Emit new event when an account is created. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-accounts)",
type: "source",
version: "0.0.4",
version: "0.0.5",
dedupe: "unique",
props: {
...common.props,
Expand All @@ -27,10 +27,11 @@ export default {
return "accounts";
},
getResourceFn() {
return this.app.listAccounts;
return this.app.searchAccounts;
},
getResourceFnArgs() {
return {
debug: true,
params: {
account_stage_ids: this.accountStageIds,
sort_by_field: "account_created_at",
Expand Down
Loading
Loading