Skip to content

Commit bfc1790

Browse files
committed
gloria_ai init
1 parent 8aac563 commit bfc1790

File tree

3 files changed

+140
-3
lines changed

3 files changed

+140
-3
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import gloria_ai from "../../gloria_ai.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "gloria_ai-create-lead",
6+
name: "Create Lead",
7+
description: "Creates a new lead/contact in Gloria.ai. [See the documentation]().",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
gloria_ai: {
12+
type: "app",
13+
app: "gloria_ai",
14+
},
15+
leadName: {
16+
propDefinition: [
17+
"gloria_ai",
18+
"leadName",
19+
],
20+
},
21+
phone: {
22+
propDefinition: [
23+
"gloria_ai",
24+
"phone",
25+
],
26+
optional: true,
27+
},
28+
email: {
29+
propDefinition: [
30+
"gloria_ai",
31+
"email",
32+
],
33+
optional: true,
34+
},
35+
initiation: {
36+
propDefinition: [
37+
"gloria_ai",
38+
"initiation",
39+
],
40+
optional: true,
41+
},
42+
tags: {
43+
propDefinition: [
44+
"gloria_ai",
45+
"tags",
46+
],
47+
optional: true,
48+
},
49+
status: {
50+
propDefinition: [
51+
"gloria_ai",
52+
"status",
53+
],
54+
optional: true,
55+
},
56+
},
57+
async run({ $ }) {
58+
const response = await this.gloria_ai.createContact();
59+
$.export("$summary", `Created lead ${this.leadName}`);
60+
return response;
61+
},
62+
};
Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,86 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "gloria_ai",
4-
propDefinitions: {},
6+
version: "0.0.{{ts}}",
7+
propDefinitions: {
8+
leadName: {
9+
type: "string",
10+
label: "Lead Name",
11+
description: "The name of the lead",
12+
},
13+
phone: {
14+
type: "string",
15+
label: "Phone",
16+
description: "Phone number of the lead",
17+
optional: true,
18+
},
19+
email: {
20+
type: "string",
21+
label: "Email",
22+
description: "Email address of the lead",
23+
optional: true,
24+
},
25+
initiation: {
26+
type: "string",
27+
label: "Initiation",
28+
description: "Initiation details for the lead",
29+
optional: true,
30+
},
31+
tags: {
32+
type: "string[]",
33+
label: "Tags",
34+
description: "Tags associated with the lead",
35+
optional: true,
36+
},
37+
status: {
38+
type: "string",
39+
label: "Status",
40+
description: "Status of the lead",
41+
optional: true,
42+
},
43+
},
544
methods: {
6-
// this.$auth contains connected account data
45+
// Existing method from the existing app file
746
authKeys() {
847
console.log(Object.keys(this.$auth));
948
},
49+
_baseUrl() {
50+
return "https://api.iamgloria.com/api";
51+
},
52+
async _makeRequest(opts = {}) {
53+
const {
54+
$ = this,
55+
method = "GET",
56+
path = "/",
57+
headers,
58+
...otherOpts
59+
} = opts;
60+
return axios($, {
61+
...otherOpts,
62+
method,
63+
url: this._baseUrl() + path,
64+
headers: {
65+
...headers,
66+
Authorization: `Bearer ${this.$auth.api_token}`,
67+
},
68+
});
69+
},
70+
async createContact(opts = {}) {
71+
return this._makeRequest({
72+
method: "POST",
73+
path: "/api/v1/contacts",
74+
data: {
75+
name: this.leadName,
76+
phone: this.phone,
77+
email: this.email,
78+
initiation: this.initiation,
79+
tags: this.tags,
80+
status: this.status,
81+
},
82+
...opts,
83+
});
84+
},
1085
},
1186
};

components/gloria_ai/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
"publishConfig": {
1313
"access": "public"
1414
}
15-
}
15+
}

0 commit comments

Comments
 (0)