-
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
Showing
7 changed files
with
256 additions
and
7 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,78 @@ | ||
import app from "../../wiza.app.mjs"; | ||
|
||
export default { | ||
key: "wiza-create-list", | ||
name: "Create List", | ||
description: "Create a list of people to enrich. [See the documentation](https://wiza.co/api-docs#/paths/~1api~1lists/post)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
name: { | ||
propDefinition: [ | ||
app, | ||
"name", | ||
], | ||
}, | ||
enrichmentLevel: { | ||
propDefinition: [ | ||
app, | ||
"enrichmentLevel", | ||
], | ||
}, | ||
acceptGeneric: { | ||
propDefinition: [ | ||
app, | ||
"acceptGeneric", | ||
], | ||
}, | ||
acceptPersonal: { | ||
propDefinition: [ | ||
app, | ||
"acceptPersonal", | ||
], | ||
}, | ||
acceptWork: { | ||
propDefinition: [ | ||
app, | ||
"acceptWork", | ||
], | ||
}, | ||
fullName: { | ||
propDefinition: [ | ||
app, | ||
"fullName", | ||
], | ||
}, | ||
company: { | ||
propDefinition: [ | ||
app, | ||
"company", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.app.createList({ | ||
$, | ||
data: { | ||
name: this.description, | ||
enrichmentLevel: this.enrichmentLevel, | ||
email_options: { | ||
accept_generic: this.acceptGeneric, | ||
accept_personal: this.acceptPersonal, | ||
accept_work: this.acceptWork, | ||
}, | ||
items: [ | ||
{ | ||
full_name: this.fullName, | ||
company: this.company, | ||
}, | ||
], | ||
}, | ||
}); | ||
|
||
$.export("$summary", `'${response.status.message}', your list's ID is '${response.data.id}'`); | ||
|
||
return response; | ||
}, | ||
}; |
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,37 @@ | ||
import app from "../../wiza.app.mjs"; | ||
|
||
export default { | ||
key: "wiza-get-contacts", | ||
name: "Get Contacts", | ||
description: "Get contacts for a list. [See the documentation](https://wiza.co/api-docs#/paths/~1api~1lists~1%7Bid%7D/get)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
id: { | ||
propDefinition: [ | ||
app, | ||
"id", | ||
], | ||
}, | ||
segment: { | ||
propDefinition: [ | ||
app, | ||
"segment", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.app.getContacts({ | ||
$, | ||
id: this.id, | ||
params: { | ||
segment: this.segment, | ||
}, | ||
}); | ||
|
||
$.export("$summary", "Successfully retrieved the list's contacts"); | ||
|
||
return response; | ||
}, | ||
}; |
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,28 @@ | ||
import app from "../../wiza.app.mjs"; | ||
|
||
export default { | ||
key: "wiza-get-list", | ||
name: "Get List", | ||
description: "Get the list with the given id. [See the documentation](https://wiza.co/api-docs#/paths/~1api~1lists~1%7Bid%7D/get)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
id: { | ||
propDefinition: [ | ||
app, | ||
"id", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.app.getList({ | ||
$, | ||
id: this.id, | ||
}); | ||
|
||
$.export("$summary", `The status of your list is: '${response.data.status}'`); | ||
|
||
return response; | ||
}, | ||
}; |
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,11 @@ | ||
export default { | ||
SEGMENTS: [ | ||
"people", | ||
"valid", | ||
"risky", | ||
], | ||
ENRICHMENT_LEVELS: [ | ||
"partial", | ||
"full", | ||
], | ||
}; |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@pipedream/wiza", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Pipedream Wiza Components", | ||
"main": "wiza.app.mjs", | ||
"keywords": [ | ||
|
@@ -11,5 +11,8 @@ | |
"author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@pipedream/platform": "^1.6.5" | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,100 @@ | ||
import { axios } from "@pipedream/platform"; | ||
import constants from "./common/constants.mjs"; | ||
|
||
export default { | ||
type: "app", | ||
app: "wiza", | ||
propDefinitions: {}, | ||
propDefinitions: { | ||
acceptWork: { | ||
type: "boolean", | ||
label: "Work Email", | ||
description: "Accept professional email address? i.e. '[email protected]'", | ||
}, | ||
acceptPersonal: { | ||
type: "boolean", | ||
label: "Personal Email", | ||
description: "Accept personal email address? i.e. '[email protected]'", | ||
}, | ||
acceptGeneric: { | ||
type: "boolean", | ||
label: "Generic Email", | ||
description: "Accept generic email address? i.e. '[email protected]'", | ||
}, | ||
enrichmentLevel: { | ||
type: "string", | ||
label: "Enrichment Level", | ||
description: "Enrichment level of the list.", | ||
options: constants.ENRICHMENT_LEVELS, | ||
}, | ||
name: { | ||
type: "string", | ||
label: "Name", | ||
description: "Name of the list", | ||
}, | ||
fullName: { | ||
type: "string", | ||
label: "Full Name", | ||
description: "Full name of the contact", | ||
}, | ||
company: { | ||
type: "string", | ||
label: "Company", | ||
description: "Name of the company", | ||
}, | ||
id: { | ||
type: "string", | ||
label: "List ID", | ||
description: "ID of the list", | ||
}, | ||
segment: { | ||
type: "string", | ||
label: "Segment", | ||
description: "Specify the segment of contacts to return", | ||
options: constants.SEGMENTS, | ||
}, | ||
}, | ||
methods: { | ||
// this.$auth contains connected account data | ||
authKeys() { | ||
console.log(Object.keys(this.$auth)); | ||
_baseUrl() { | ||
return "https://wiza.co/api"; | ||
}, | ||
async _makeRequest(opts = {}) { | ||
const { | ||
$ = this, | ||
path, | ||
headers, | ||
...otherOpts | ||
} = opts; | ||
return axios($, { | ||
...otherOpts, | ||
url: this._baseUrl() + path, | ||
headers: { | ||
...headers, | ||
Authorization: `Bearer ${this.$auth.api_key}`, | ||
}, | ||
}); | ||
}, | ||
async getList({ | ||
args, id, | ||
}) { | ||
return this._makeRequest({ | ||
path: `/lists/${id}`, | ||
...args, | ||
}); | ||
}, | ||
async getContacts({ | ||
id, ...args | ||
}) { | ||
return this._makeRequest({ | ||
path: `/lists/${id}/contacts`, | ||
...args, | ||
}); | ||
}, | ||
async createList(args = {}) { | ||
return this._makeRequest({ | ||
method: "post", | ||
path: "/lists", | ||
...args, | ||
}); | ||
}, | ||
}, | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.