Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions components/gloria_ai/actions/create-lead/create-lead.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import gloriaAi from "../../gloria_ai.app.mjs";

export default {
key: "gloria_ai-create-lead",
name: "Create Lead",
description: "Creates a new lead/contact in Gloria.ai. [See the documentation](https://api.iamgloria.com/api).",
version: "0.0.1",
type: "action",
props: {
gloriaAi,
leadName: {
propDefinition: [
gloriaAi,
"leadName",
],
},
phone: {
propDefinition: [
gloriaAi,
"phone",
],
},
email: {
propDefinition: [
gloriaAi,
"email",
],
},
initiation: {
propDefinition: [
gloriaAi,
"initiation",
],
},
tags: {
propDefinition: [
gloriaAi,
"tags",
],
},
status: {
propDefinition: [
gloriaAi,
"status",
],
},
},
async run({ $ }) {
const response = await this.gloriaAi.createContact({
$,
data: {
tenantId: this.gloriaAi.$auth.tenant_id,
createdAt: Date.now(),
name: [
this.leadName,
],
phone: this.phone && [
this.phone,
],
email: this.email && [
this.email,
],
origin: "api",
initiation: this.initiation,
tags: this.tags,
status: this.status,
},
});
$.export("$summary", `Successfully created lead with ID: ${response.id}`);
return response;
},
};
75 changes: 71 additions & 4 deletions components/gloria_ai/gloria_ai.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,78 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "gloria_ai",
propDefinitions: {},
propDefinitions: {
leadName: {
type: "string",
label: "Lead Name",
description: "The name of the lead",
},
phone: {
type: "string",
label: "Phone",
description: "Phone number of the lead",
optional: true,
},
email: {
type: "string",
label: "Email",
description: "Email address of the lead",
optional: true,
},
initiation: {
type: "string",
label: "Initiation",
description: "Initiation details for the lead",
options: [
"Inbound",
"Outbound",
],
optional: true,
},
tags: {
type: "string[]",
label: "Tags",
description: "Tags associated with the lead",
optional: true,
},
status: {
type: "string",
label: "Status",
description: "Status of the lead",
options: [
"active",
"archived",
"favorite",
],
optional: true,
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://api.iamgloria.com/api/v1";
},
_makeRequest({
$ = this,
path,
...otherOpts
}) {
return axios($, {
...otherOpts,
url: `${this._baseUrl()}${path}`,
headers: {
"Authorization": `Bearer ${this.$auth.api_key}`,
"tenant-id": `${this.$auth.tenant_id}`,
},
});
},
createContact(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/contacts",
...opts,
});
},
},
};
7 changes: 5 additions & 2 deletions components/gloria_ai/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/gloria_ai",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Gloria AI Components",
"main": "gloria_ai.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3"
}
}
}
9 changes: 6 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading