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
3 changes: 0 additions & 3 deletions components/cloze/.gitignore

This file was deleted.

81 changes: 81 additions & 0 deletions components/cloze/actions/create-note/create-note.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import app from "../../cloze.app.mjs";

export default {
key: "cloze-create-note",
name: "Create Note",
description: "Creates a note in Cloze. [See the documentation](https://api.cloze.com/api-docs/#!/Content/post_v1_createcontent).",
version: "0.0.1",
type: "action",
props: {
app,
uniqueId: {
type: "string",
label: "Unique ID",
description: "A unique identifier for this content record. This will often be the unique Id in an external system so that updates can be matched up with the record in Cloze.",
},
source: {
type: "string",
label: "Source",
description: "The source that this content record originally came from (Eg. `todoist.com`). Must be a valid domain.",
},
date: {
type: "string",
label: "Date",
description: "When the content should show up in the timeline. Can be a string or a UTC timestamp in ms since the epoch. Eg. `2021-01-01` or `1609459200000`.",
optional: true,
},
from: {
type: "string",
label: "From",
description: "From address for this content record (the address of the person created the record). This can be an email address, phone number, social handle or app link (Eg. `na16.salesforce.com:006j000000Pkp1d`)",
optional: true,
},
subject: {
type: "string",
label: "Subject",
description: "Subject of the communication record.",
optional: true,
},
body: {
type: "string",
label: "Body",
description: "Body text of the communication record.",
},
additionalData: {
type: "object",
label: "Additional Data",
description: "Additional details for the note in JSON format. [See the documentation](https://api.cloze.com/api-docs/#!/Content/post_v1_createcontent).",
optional: true,
},
},
async run({ $ }) {
const {
app,
uniqueId,
date,
from,
source,
subject,
body,
additionalData,
} = this;

const response = await app.addContentRecord({
$,
data: {
uniqueid: uniqueId,
date,
style: "note",
from,
source,
subject,
body,
...additionalData,
},
});

$.export("$summary", "Successfully created note.");

return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
import app from "../../cloze.app.mjs";
import utils from "../../common/utils.mjs";

export default {
key: "cloze-create-update-company",
name: "Create Or Update Company",
description: "Create a new company or enhance an existing company within Cloze. Companies can be created with just a domain name or both a name and another unique identifier such as a phone number and email address. [See the documentation](https://api.cloze.com/api-docs/#!/Relations_-_Companies/post_v1_companies_create).",
version: "0.0.1",
type: "action",
props: {
app,
name: {
type: "string",
label: "Company Name",
description: "The name of the company.",
optional: true,
},
emails: {
type: "string[]",
label: "Emails",
description: "The emails of the company. Each email should be a JSON object with `value` key. [See the documentation](https://api.cloze.com/api-docs/#!/Relations_-_Companies/post_v1_companies_create).",
optional: true,
},
phones: {
type: "string[]",
label: "Phones",
description: "The phones of the company. Each phone should be a JSON object with `value` key. [See the documentation](https://api.cloze.com/api-docs/#!/Relations_-_Companies/post_v1_companies_create).",
optional: true,
},
domains: {
type: "string[]",
label: "Domains",
description: "The domains of the company.",
optional: true,
},
segment: {
type: "string",
label: "Segment",
description: "The segment of the company.",
optional: true,
options: [
"customer",
"partner",
"supplier",
"investor",
"advisor",
"competitor",
"custom1",
"custom2",
"custom3",
"custom4",
"custom5",
"coworker",
"family",
"friend",
"network",
"personal1",
"personal2",
],
},
step: {
type: "string",
label: "Step",
description: "Unique Id of Next Step",
optional: true,
},
stage: {
type: "string",
label: "Stage",
description: "The stage of the company.",
optional: true,
options: [
{
label: "Lead Stage",
value: "lead",
},
{
label: "Potential Stage",
value: "future",
},
{
label: "Active Stage",
value: "current",
},
{
label: "Inactive Stage",
value: "past",
},
{
label: "Lost Stage",
value: "out",
},
],
},
assignTo: {
type: "string",
label: "Assign To",
description: "Assign this company to this team member.",
optional: true,
},
additionalData: {
type: "object",
label: "Additional Data",
description: "Additional details for the company in JSON format. [See the documentation](https://api.cloze.com/api-docs/#!/Relations_-_Companies/post_v1_companies_create).",
optional: true,
},
},
methods: {
createCompany(args = {}) {
return this.app.post({
path: "/companies/create",
...args,
});
},
},
async run({ $ }) {
const {
createCompany,
name,
emails,
phones,
domains,
segment,
step,
stage,
assignTo,
additionalData,
} = this;

const response = await createCompany({
$,
data: {
name,
emails: utils.parseArray(emails),
phones: utils.parseArray(phones),
domains,
segment,
step,
stage,
assignTo,
...additionalData,
},
});

$.export("$summary", "Successfully created/updated company.");
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import app from "../../cloze.app.mjs";
import utils from "../../common/utils.mjs";

export default {
key: "cloze-create-update-project",
name: "Create Or Update Project",
description: "Create a new project or merge updates into an existing one. [See the documentation](https://api.cloze.com/api-docs/#!/Relations_-_Projects/post_v1_projects_create).",
version: "0.0.1",
type: "action",
props: {
app,
name: {
type: "string",
label: "Project Name",
description: "The name of the project.",
},
appLinks: {
type: "string[]",
label: "App Links",
description: "The app links of the project. Each app link should be a JSON object with at least `source` and `uniqueid` keys. [See the documentation](https://api.cloze.com/api-docs/#!/Relations_-_Projects/post_v1_projects_create).",
optional: true,
default: [
JSON.stringify({
source: "na16.salesforce.com",
uniqueid: "sdf234v",
}),
],
},
summary: {
type: "string",
label: "Project Summary",
description: "The summary of the project.",
optional: true,
},
stage: {
type: "string",
label: "Stage",
description: "The stage of the project.",
optional: true,
options: [
{
label: "Potential Stage",
value: "future",
},
{
label: "Active Stage",
value: "current",
},
{
label: "Won or Done stage",
value: "won",
},
{
label: "Lost Stage",
value: "lost",
},
],
},
segment: {
type: "string",
label: "Segment",
description: "The segment of the project.",
optional: true,
options: [
"project",
"project1",
"project2",
"project3",
"project4",
"project5",
],
},
additionalData: {
type: "object",
label: "Additional Data",
description: "Additional details for the project in JSON format. [See the documentation](https://api.cloze.com/api-docs/#!/Relations_-_Projects/post_v1_projects_create).",
optional: true,
},
},
methods: {
createProject(args = {}) {
return this.app.post({
path: "/projects/create",
...args,
});
},
},
async run({ $ }) {
const {
createProject,
name,
appLinks,
summary,
stage,
segment,
additionalData,
} = this;

const response = await createProject({
$,
data: {
name,
appLinks: utils.parseArray(appLinks),
summary,
stage,
segment,
...additionalData,
},
});

$.export("$summary", "Successfully created/updated project.");

return response;
},
};
13 changes: 0 additions & 13 deletions components/cloze/app/cloze.app.ts

This file was deleted.

Loading
Loading