-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0283bcf
commit 4f18977
Showing
7 changed files
with
718 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import benchmarkone from "../../benchmarkone.app.mjs"; | ||
import { axios } from "@pipedream/platform"; | ||
|
||
export default { | ||
key: "benchmarkone-add-note", | ||
name: "Add Note to Contact", | ||
description: "Adds a note to a BenchmarkONE contact. [See the documentation]().", | ||
version: "0.0.{{ts}}", | ||
type: "action", | ||
props: { | ||
benchmarkone, | ||
contactId: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"contactId", | ||
], | ||
}, | ||
contactEmail: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"contactEmail", | ||
], | ||
optional: true, | ||
}, | ||
noteContent: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"noteContent", | ||
], | ||
}, | ||
firstName: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"firstName", | ||
], | ||
optional: true, | ||
}, | ||
lastName: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"lastName", | ||
], | ||
optional: true, | ||
}, | ||
email: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"email", | ||
], | ||
optional: true, | ||
}, | ||
phoneNumbers: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"phoneNumbers", | ||
], | ||
optional: true, | ||
}, | ||
addresses: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"addresses", | ||
], | ||
optional: true, | ||
}, | ||
}, | ||
async run({ $ }) { | ||
try { | ||
if (!this.contactId && !this.contactEmail) { | ||
throw new Error("Either contactId or contactEmail must be provided."); | ||
} | ||
|
||
const response = await this.benchmarkone.addNoteToContact({ | ||
contactId: this.contactId, | ||
contactEmail: this.contactEmail, | ||
firstName: this.firstName, | ||
lastName: this.lastName, | ||
email: this.email, | ||
phoneNumbers: this.phoneNumbers, | ||
addresses: this.addresses, | ||
noteContent: this.noteContent, | ||
}); | ||
|
||
if (response && response.contactId) { | ||
$.export("$summary", `Added note to contact with ID ${response.contactId}`); | ||
} else if (this.contactEmail) { | ||
$.export("$summary", `Added note to contact with email ${this.contactEmail}`); | ||
} else { | ||
$.export("$summary", "Added note to contact"); | ||
} | ||
|
||
return response; | ||
} catch (error) { | ||
$.export("$summary", `Failed to add note: ${error.message}`); | ||
throw error; | ||
} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import benchmarkone from "../../benchmarkone.app.mjs"; | ||
import { axios } from "@pipedream/platform"; | ||
|
||
export default { | ||
key: "benchmarkone-add-tag", | ||
name: "Add Tag to Contact", | ||
description: "Adds tags to a contact. If the contact does not exist, it will be created first. [See the documentation]().", | ||
version: "0.0.{{ts}}", | ||
type: "action", | ||
props: { | ||
benchmarkone, | ||
tagNames: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"tagNames", | ||
], | ||
}, | ||
email: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"email", | ||
], | ||
}, | ||
contactId: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"contactId", | ||
], | ||
optional: true, | ||
}, | ||
contactEmail: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"contactEmail", | ||
], | ||
optional: true, | ||
}, | ||
firstName: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"firstName", | ||
], | ||
optional: true, | ||
}, | ||
lastName: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"lastName", | ||
], | ||
optional: true, | ||
}, | ||
phoneNumbers: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"phoneNumbers", | ||
], | ||
optional: true, | ||
}, | ||
addresses: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"addresses", | ||
], | ||
optional: true, | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.benchmarkone.addTagToContact({ | ||
contactId: this.contactId, | ||
contactEmail: this.contactEmail, | ||
firstName: this.firstName, | ||
lastName: this.lastName, | ||
email: this.email, | ||
phoneNumbers: this.phoneNumbers, | ||
addresses: this.addresses, | ||
tagNames: this.tagNames, | ||
}); | ||
|
||
const contactId = response.contactId; | ||
const addedTags = this.tagNames.join(", "); | ||
$.export("$summary", `Added tags [${addedTags}] to contact ID ${contactId}`); | ||
return response; | ||
}, | ||
}; |
60 changes: 60 additions & 0 deletions
60
components/benchmarkone/actions/create-contact/create-contact.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import benchmarkone from "../../benchmarkone.app.mjs"; | ||
import { axios } from "@pipedream/platform"; | ||
|
||
export default { | ||
key: "benchmarkone-create-contact", | ||
name: "Create Contact", | ||
description: "Creates a new contact in BenchmarkONE. [See the documentation]()", | ||
version: "0.0.{{ts}}", | ||
type: "action", | ||
props: { | ||
benchmarkone, | ||
firstName: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"firstName", | ||
], | ||
}, | ||
lastName: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"lastName", | ||
], | ||
}, | ||
email: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"email", | ||
], | ||
}, | ||
phoneNumbers: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"phoneNumbers", | ||
], | ||
optional: true, | ||
}, | ||
addresses: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"addresses", | ||
], | ||
optional: true, | ||
}, | ||
}, | ||
async run({ $ }) { | ||
try { | ||
const response = await this.benchmarkone.createContact({ | ||
firstName: this.firstName, | ||
lastName: this.lastName, | ||
email: this.email, | ||
phoneNumbers: this.phoneNumbers, | ||
addresses: this.addresses, | ||
}); | ||
$.export("$summary", `Created contact with ID: ${response.contactId}`); | ||
return response; | ||
} catch (error) { | ||
throw new Error(`Failed to create contact: ${error.message}`); | ||
} | ||
}, | ||
}; |
69 changes: 69 additions & 0 deletions
69
components/benchmarkone/actions/update-contact/update-contact.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import benchmarkone from "../../benchmarkone.app.mjs"; | ||
import { axios } from "@pipedream/platform"; | ||
|
||
export default { | ||
key: "benchmarkone-update-contact", | ||
name: "Update Contact", | ||
description: "Updates an existing contact. [See the documentation](https://sandbox.hatchbuck.com/api/dist/)", | ||
version: "0.0.{{ts}}", | ||
type: "action", | ||
props: { | ||
benchmarkone: { | ||
Check warning on line 11 in components/benchmarkone/actions/update-contact/update-contact.mjs
|
||
type: "app", | ||
app: "benchmarkone", | ||
}, | ||
contactId: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"contactId", | ||
], | ||
}, | ||
contactEmail: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"contactEmail", | ||
], | ||
optional: true, | ||
}, | ||
firstName: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"firstName", | ||
], | ||
optional: true, | ||
}, | ||
lastName: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"lastName", | ||
], | ||
optional: true, | ||
}, | ||
phoneNumbers: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"phoneNumbers", | ||
], | ||
optional: true, | ||
}, | ||
addresses: { | ||
propDefinition: [ | ||
benchmarkone, | ||
"addresses", | ||
], | ||
optional: true, | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.benchmarkone.updateContact({ | ||
contactId: this.contactId, | ||
contactEmail: this.contactEmail, | ||
firstName: this.firstName, | ||
lastName: this.lastName, | ||
phoneNumbers: this.phoneNumbers, | ||
addresses: this.addresses, | ||
}); | ||
$.export("$summary", "Contact updated successfully."); | ||
return response; | ||
}, | ||
}; |
Oops, something went wrong.