diff --git a/components/apollo_io/actions/add-contacts-to-sequence/add-contacts-to-sequence.mjs b/components/apollo_io/actions/add-contacts-to-sequence/add-contacts-to-sequence.mjs index 9e23ad1bfaf0a..84b7a910efe7d 100644 --- a/components/apollo_io/actions/add-contacts-to-sequence/add-contacts-to-sequence.mjs +++ b/components/apollo_io/actions/add-contacts-to-sequence/add-contacts-to-sequence.mjs @@ -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.2", + version: "0.0.3", props: { app, sequenceId: { diff --git a/components/apollo_io/actions/create-account/create-account.mjs b/components/apollo_io/actions/create-account/create-account.mjs index 15fc8f19445e6..144709ebe3600 100644 --- a/components/apollo_io/actions/create-account/create-account.mjs +++ b/components/apollo_io/actions/create-account/create-account.mjs @@ -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.2", + version: "0.0.3", props: { app, name: { diff --git a/components/apollo_io/actions/create-contact/create-contact.mjs b/components/apollo_io/actions/create-contact/create-contact.mjs index 8c8cd51617cea..a5467c95557f8 100644 --- a/components/apollo_io/actions/create-contact/create-contact.mjs +++ b/components/apollo_io/actions/create-contact/create-contact.mjs @@ -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.3", + version: "0.0.4", props: { app, email: { diff --git a/components/apollo_io/actions/create-opportunity/create-opportunity.mjs b/components/apollo_io/actions/create-opportunity/create-opportunity.mjs index 36611eb33daaf..25c414cdb8df3 100644 --- a/components/apollo_io/actions/create-opportunity/create-opportunity.mjs +++ b/components/apollo_io/actions/create-opportunity/create-opportunity.mjs @@ -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.1", + version: "0.0.2", props: { app, ownerId: { diff --git a/components/apollo_io/actions/create-update-contact/create-update-contact.mjs b/components/apollo_io/actions/create-update-contact/create-update-contact.mjs new file mode 100644 index 0000000000000..3c23feed64a0e --- /dev/null +++ b/components/apollo_io/actions/create-update-contact/create-update-contact.mjs @@ -0,0 +1,121 @@ +import app from "../../apollo_io.app.mjs"; +import utils from "../../common/utils.mjs"; + +export default { + key: "apollo_io-create-update-contact", + 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.1", + props: { + app, + email: { + propDefinition: [ + app, + "email", + ], + }, + firstName: { + propDefinition: [ + app, + "firstName", + ], + }, + lastName: { + propDefinition: [ + app, + "lastName", + ], + }, + title: { + propDefinition: [ + app, + "title", + ], + }, + accountId: { + propDefinition: [ + app, + "accountId", + ], + optional: true, + }, + websiteUrl: { + propDefinition: [ + app, + "websiteUrl", + ], + }, + labelNames: { + propDefinition: [ + app, + "labelNames", + ], + }, + contactStageId: { + propDefinition: [ + app, + "contactStageId", + ], + optional: true, + }, + address: { + propDefinition: [ + app, + "address", + ], + }, + phone: { + propDefinition: [ + app, + "phone", + ], + }, + }, + async run({ $: step }) { + let contact = {}; + let action = "created"; + let data = utils.cleanObject({ + email: this.email, + first_name: this.firstName, + last_name: this.lastName, + title: this.title, + account_id: this.accountId, + website_url: this.websiteUrl, + label_names: this.labelNames, + contact_stage_id: this.contactStageId, + present_raw_address: this.address, + direct_phone: this.phone, + }); + + const { contacts } = await this.app.listContacts({ + params: { + q_keywords: this.email, + }, + }); + + if (contacts.length) { + action = "updated"; + contact = contacts[0]; + + await this.app.updateContact({ + step, + contactId: contact.id, + data: { + ...contact, + ...data, + }, + }); + } else { + const response = await this.app.createContact({ + step, + data, + }); + contact = response.contact; + } + + step.export("$summary", `Successfully ${action} contact with ID ${contact.id}`); + + return contact; + }, +}; diff --git a/components/apollo_io/actions/get-opportunity/get-opportunity.mjs b/components/apollo_io/actions/get-opportunity/get-opportunity.mjs index 9d3aa6191ba3b..3ecb429ed1480 100644 --- a/components/apollo_io/actions/get-opportunity/get-opportunity.mjs +++ b/components/apollo_io/actions/get-opportunity/get-opportunity.mjs @@ -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.1", + version: "0.0.2", props: { app, opportunityId: { diff --git a/components/apollo_io/actions/people-enrichment/people-enrichment.mjs b/components/apollo_io/actions/people-enrichment/people-enrichment.mjs index a93693a6fe2a6..dbfaaabb5d116 100644 --- a/components/apollo_io/actions/people-enrichment/people-enrichment.mjs +++ b/components/apollo_io/actions/people-enrichment/people-enrichment.mjs @@ -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.3", + version: "0.0.4", props: { app, firstName: { diff --git a/components/apollo_io/actions/search-accounts/search-accounts.mjs b/components/apollo_io/actions/search-accounts/search-accounts.mjs index a05a451375d82..3ab3e7ec188cd 100644 --- a/components/apollo_io/actions/search-accounts/search-accounts.mjs +++ b/components/apollo_io/actions/search-accounts/search-accounts.mjs @@ -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.1", + version: "0.0.2", props: { app, search: { diff --git a/components/apollo_io/actions/search-contacts/search-contacts.mjs b/components/apollo_io/actions/search-contacts/search-contacts.mjs index 902752e32497c..64cdf64094156 100644 --- a/components/apollo_io/actions/search-contacts/search-contacts.mjs +++ b/components/apollo_io/actions/search-contacts/search-contacts.mjs @@ -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.1", + version: "0.0.2", props: { app, search: { diff --git a/components/apollo_io/actions/search-sequences/search-sequences.mjs b/components/apollo_io/actions/search-sequences/search-sequences.mjs index be62181650603..efe150e808fa6 100644 --- a/components/apollo_io/actions/search-sequences/search-sequences.mjs +++ b/components/apollo_io/actions/search-sequences/search-sequences.mjs @@ -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.1", + version: "0.0.2", props: { app, search: { diff --git a/components/apollo_io/actions/update-account-stage/update-account-stage.mjs b/components/apollo_io/actions/update-account-stage/update-account-stage.mjs index 35a9a8879b435..41ddcb560a606 100644 --- a/components/apollo_io/actions/update-account-stage/update-account-stage.mjs +++ b/components/apollo_io/actions/update-account-stage/update-account-stage.mjs @@ -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.2", + version: "0.0.3", props: { app, accountIds: { diff --git a/components/apollo_io/actions/update-account/update-account.mjs b/components/apollo_io/actions/update-account/update-account.mjs index 576f925231a35..cc4e7f46de2f2 100644 --- a/components/apollo_io/actions/update-account/update-account.mjs +++ b/components/apollo_io/actions/update-account/update-account.mjs @@ -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.2", + version: "0.0.3", props: { app, accountId: { diff --git a/components/apollo_io/actions/update-contact-stage/update-contact-stage.mjs b/components/apollo_io/actions/update-contact-stage/update-contact-stage.mjs index 4cfd984933c46..3ece01c6e686d 100644 --- a/components/apollo_io/actions/update-contact-stage/update-contact-stage.mjs +++ b/components/apollo_io/actions/update-contact-stage/update-contact-stage.mjs @@ -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.2", + version: "0.0.3", props: { app, contactIds: { diff --git a/components/apollo_io/actions/update-contact/update-contact.mjs b/components/apollo_io/actions/update-contact/update-contact.mjs index 04ec17fe96fb2..248c6b35d79e7 100644 --- a/components/apollo_io/actions/update-contact/update-contact.mjs +++ b/components/apollo_io/actions/update-contact/update-contact.mjs @@ -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.3", + version: "0.0.4", props: { app, contactId: { diff --git a/components/apollo_io/actions/update-opportunity/update-opportunity.mjs b/components/apollo_io/actions/update-opportunity/update-opportunity.mjs index dc40320f2d756..28ef5aabc6fa2 100644 --- a/components/apollo_io/actions/update-opportunity/update-opportunity.mjs +++ b/components/apollo_io/actions/update-opportunity/update-opportunity.mjs @@ -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.1", + version: "0.0.2", props: { app, opportunityId: { diff --git a/components/apollo_io/package.json b/components/apollo_io/package.json index 6d4ae79079fea..48822e078ffbf 100644 --- a/components/apollo_io/package.json +++ b/components/apollo_io/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/apollo_io", - "version": "0.3.0", + "version": "0.4.0", "description": "Pipedream Apollo.io Components", "main": "apollo_io.app.mjs", "keywords": [ @@ -13,7 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.6.0", + "@pipedream/platform": "^3.0.3", "md5": "^2.3.0" } } diff --git a/components/apollo_io/sources/account-created/account-created.mjs b/components/apollo_io/sources/account-created/account-created.mjs index 282fd099a06bd..ad39bc2776f78 100644 --- a/components/apollo_io/sources/account-created/account-created.mjs +++ b/components/apollo_io/sources/account-created/account-created.mjs @@ -6,7 +6,7 @@ export default { name: "Account Created", description: "Triggers when an account is created. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-accounts)", type: "source", - version: "0.0.2", + version: "0.0.3", dedupe: "unique", props: { ...common.props, diff --git a/components/apollo_io/sources/account-updated/account-updated.mjs b/components/apollo_io/sources/account-updated/account-updated.mjs index a9775226a870d..f2b1afe8d22a5 100644 --- a/components/apollo_io/sources/account-updated/account-updated.mjs +++ b/components/apollo_io/sources/account-updated/account-updated.mjs @@ -7,7 +7,7 @@ export default { name: "Account Updated", description: "Triggers when an account is updated. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-contacts)", type: "source", - version: "0.0.2", + version: "0.0.3", dedupe: "unique", props: { ...common.props, diff --git a/components/apollo_io/sources/contact-created/contact-created.mjs b/components/apollo_io/sources/contact-created/contact-created.mjs index e0bb9faca9eb6..a8978e5c9a349 100644 --- a/components/apollo_io/sources/contact-created/contact-created.mjs +++ b/components/apollo_io/sources/contact-created/contact-created.mjs @@ -6,7 +6,7 @@ export default { name: "Contact Created", description: "Triggers when a contact is created. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-contacts)", type: "source", - version: "0.0.4", + version: "0.0.5", dedupe: "unique", methods: { ...common.methods, diff --git a/components/apollo_io/sources/contact-updated/contact-updated.mjs b/components/apollo_io/sources/contact-updated/contact-updated.mjs index 45b49d4819695..7b4b7619dee54 100644 --- a/components/apollo_io/sources/contact-updated/contact-updated.mjs +++ b/components/apollo_io/sources/contact-updated/contact-updated.mjs @@ -6,7 +6,7 @@ export default { name: "Contact Updated", description: "Triggers when a contact is updated. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-contacts)", type: "source", - version: "0.0.4", + version: "0.0.5", dedupe: "unique", methods: { ...common.methods, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dfc0fe9556e70..6a42544305b82 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -700,10 +700,10 @@ importers: components/apollo_io: specifiers: - '@pipedream/platform': ^1.6.0 + '@pipedream/platform': ^3.0.3 md5: ^2.3.0 dependencies: - '@pipedream/platform': 1.6.0 + '@pipedream/platform': 3.0.3 md5: 2.3.0 components/appcircle: @@ -36639,7 +36639,7 @@ packages: dev: false /verror/1.10.0: - resolution: {integrity: sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=} + resolution: {integrity: sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==} engines: {'0': node >=0.6.0} dependencies: assert-plus: 1.0.0