Skip to content

Commit f87cf9f

Browse files
authored
New Components - gozen_growth (#13728)
* gozen_growth init * [Components] gozen_growth #13688 Actions - Create Or Update Contact * pnpm update
1 parent 0614831 commit f87cf9f

File tree

4 files changed

+129
-59
lines changed

4 files changed

+129
-59
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import gozenGrowth from "../../gozen_growth.app.mjs";
2+
3+
export default {
4+
key: "gozen_growth-create-or-update-contact",
5+
name: "Create Or Update Contact",
6+
description: "Create or update a contact a on Gozen Growth. [See the documentation](https://docs.gozen.io/docs/automation/how-to-use-webhook-trigger)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
gozenGrowth,
11+
emailAddress: {
12+
type: "string",
13+
label: "Email Address",
14+
description: "The email address of the contact. Must be a valid email address.",
15+
},
16+
firstName: {
17+
type: "string",
18+
label: "First Name",
19+
description: "The first name of the contact. String without special characters.",
20+
},
21+
lastName: {
22+
type: "string",
23+
label: "Last Name",
24+
description: "The last name of the contact. String without special characters.",
25+
optional: true,
26+
},
27+
},
28+
async run({ $ }) {
29+
const response = await this.gozenGrowth.createOrUpdateContact({
30+
$,
31+
data: {
32+
contact: {
33+
email_address: this.emailAddress,
34+
first_name: this.firstName,
35+
last_name: this.lastName,
36+
},
37+
},
38+
});
39+
40+
$.export("$summary", `Successfully created or updated contact with email: ${this.emailAddress}`);
41+
return response;
42+
},
43+
};
Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "gozen_growth",
4-
propDefinitions: {},
56
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
7+
_baseUrl() {
8+
return `${this.$auth.webhook_url}`;
9+
},
10+
_headers() {
11+
return {
12+
"Authorization": `${this.$auth.authentication_token}`,
13+
};
14+
},
15+
_makeRequest({
16+
$ = this, ...opts
17+
}) {
18+
return axios($, {
19+
url: this._baseUrl(),
20+
headers: this._headers(),
21+
...opts,
22+
});
23+
},
24+
async createOrUpdateContact(opts = {}) {
25+
return this._makeRequest({
26+
method: "POST",
27+
...opts,
28+
});
929
},
1030
},
1131
};

components/gozen_growth/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/gozen_growth",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream GoZen Growth Components",
55
"main": "gozen_growth.app.mjs",
66
"keywords": [
@@ -11,5 +11,9 @@
1111
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.1"
1417
}
15-
}
18+
}
19+

pnpm-lock.yaml

Lines changed: 56 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)