@pipedream/highlevel_oauth 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/actions/common/common.mjs +60 -0
- package/actions/create-contact/create-contact.mjs +38 -0
- package/actions/update-contact/update-contact.mjs +41 -0
- package/actions/upsert-contact/upsert-contact.mjs +38 -0
- package/common/utils.mjs +22 -0
- package/highlevel_oauth.app.mjs +87 -0
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
The HighLevel (OAuth) API provides a suite of tools designed for marketing agencies and businesses to automate their operations, manage customer relations, and drive growth. With Pipedream, you can leverage HighLevel's capabilities to streamline workflows, such as synchronizing contact information, triggering custom actions based on client interactions, and analyzing marketing data. Integrating the HighLevel API into Pipedream workflows allows for a seamless connection with other apps and services, enabling complex automations with minimal effort.
|
|
4
|
+
|
|
5
|
+
# Example Use Cases
|
|
6
|
+
|
|
7
|
+
- **Sync New Contacts to Google Sheets**: When a new contact is added in HighLevel, automatically push their details to a Google Sheets spreadsheet. This workflow can help maintain an updated list for reporting or further analysis.
|
|
8
|
+
|
|
9
|
+
- **Trigger SMS or Email Campaigns Based on Activity**: Set up triggers in Pipedream that respond to specific client activities or statuses in HighLevel. For instance, send a personalized SMS or email when a client books an appointment or reaches a certain stage in the funnel.
|
|
10
|
+
|
|
11
|
+
- **Aggregate Data for Dashboard Reporting**: Collect key metrics from HighLevel, such as campaign performance or sales figures, and send them to a business intelligence tool like Google Data Studio for comprehensive dashboard reporting.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ConfigurationError } from "@pipedream/platform";
|
|
2
|
+
import { parseObjectEntries } from "../../common/utils.mjs";
|
|
3
|
+
import app from "../../highlevel_oauth.app.mjs";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
props: {
|
|
7
|
+
app: {
|
|
8
|
+
...app,
|
|
9
|
+
reloadProps: true,
|
|
10
|
+
},
|
|
11
|
+
name: {
|
|
12
|
+
type: "string",
|
|
13
|
+
label: "Name",
|
|
14
|
+
description: "Full name of the contact, e.g. `Rosan Deo`",
|
|
15
|
+
optional: true,
|
|
16
|
+
},
|
|
17
|
+
email: {
|
|
18
|
+
type: "string",
|
|
19
|
+
label: "Email",
|
|
20
|
+
description: "Email of the contact, e.g. `rosan@deos.com`",
|
|
21
|
+
optional: true,
|
|
22
|
+
},
|
|
23
|
+
phone: {
|
|
24
|
+
type: "string",
|
|
25
|
+
label: "Phone Number",
|
|
26
|
+
description: "Phone number of the contact, e.g. `+1 888-888-8888`",
|
|
27
|
+
optional: true,
|
|
28
|
+
},
|
|
29
|
+
additionalOptions: {
|
|
30
|
+
type: "object",
|
|
31
|
+
label: "Additional Options",
|
|
32
|
+
description:
|
|
33
|
+
"Additional parameters to send in the request. [See the documentation](https://highlevel.stoplight.io/docs/integrations/4c8362223c17b-create-contact) for available parameters. Values will be parsed as JSON where applicable.",
|
|
34
|
+
optional: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
async additionalProps() {
|
|
38
|
+
const locationId = this.app.getLocationId();
|
|
39
|
+
if (!locationId) {
|
|
40
|
+
throw new ConfigurationError("This component requires you to authenticate as a **location**, not as an agency/company. *(`locationId` field is missing from `$auth`)*");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return {};
|
|
44
|
+
},
|
|
45
|
+
methods: {
|
|
46
|
+
getData(useLocation = true) {
|
|
47
|
+
const {
|
|
48
|
+
app, additionalOptions, locationId, ...data
|
|
49
|
+
} = this;
|
|
50
|
+
return {
|
|
51
|
+
app,
|
|
52
|
+
...(useLocation && {
|
|
53
|
+
locationId: locationId ?? app.getLocationId(),
|
|
54
|
+
}),
|
|
55
|
+
...data,
|
|
56
|
+
...(additionalOptions && parseObjectEntries(additionalOptions)),
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import common from "../common/common.mjs";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
props: {
|
|
5
|
+
app, ...props
|
|
6
|
+
},
|
|
7
|
+
} = common;
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
...common,
|
|
11
|
+
key: "highlevel_oauth-create-contact",
|
|
12
|
+
name: "Create Contact",
|
|
13
|
+
description: "Creates a new contact on HighLevel. [See the documentation](https://highlevel.stoplight.io/docs/integrations/4c8362223c17b-create-contact)",
|
|
14
|
+
version: "0.0.1",
|
|
15
|
+
type: "action",
|
|
16
|
+
props: {
|
|
17
|
+
app,
|
|
18
|
+
locationId: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
app,
|
|
21
|
+
"locationId",
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
...props,
|
|
25
|
+
},
|
|
26
|
+
async run({ $ }) {
|
|
27
|
+
const {
|
|
28
|
+
app, ...data
|
|
29
|
+
} = this.getData();
|
|
30
|
+
const response = await app.createContact({
|
|
31
|
+
$,
|
|
32
|
+
data,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
$.export("$summary", `Successfully created contact (ID: ${response?.contact?.id})`);
|
|
36
|
+
return response;
|
|
37
|
+
},
|
|
38
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import common from "../common/common.mjs";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
props: {
|
|
5
|
+
app, ...props
|
|
6
|
+
},
|
|
7
|
+
} = common;
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
...common,
|
|
11
|
+
key: "highlevel_oauth-update-contact",
|
|
12
|
+
name: "Update Contact",
|
|
13
|
+
description: "Updates a selected contact on HighLevel. [See the documentation](https://highlevel.stoplight.io/docs/integrations/9ce5a739d4fb9-update-contact)",
|
|
14
|
+
version: "0.0.1",
|
|
15
|
+
type: "action",
|
|
16
|
+
props: {
|
|
17
|
+
app,
|
|
18
|
+
contactId: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
app,
|
|
21
|
+
"contactId",
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
...props,
|
|
25
|
+
},
|
|
26
|
+
async run({ $ }) {
|
|
27
|
+
const {
|
|
28
|
+
app,
|
|
29
|
+
contactId, ...data
|
|
30
|
+
|
|
31
|
+
} = this.getData(false);
|
|
32
|
+
const response = await app.updateContact({
|
|
33
|
+
$,
|
|
34
|
+
contactId,
|
|
35
|
+
data,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
$.export("$summary", `Successfully updated contact (ID: ${contactId})`);
|
|
39
|
+
return response;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import common from "../common/common.mjs";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
props: {
|
|
5
|
+
app, ...props
|
|
6
|
+
},
|
|
7
|
+
} = common;
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
...common,
|
|
11
|
+
key: "highlevel_oauth-upsert-contact",
|
|
12
|
+
name: "Upsert Contact",
|
|
13
|
+
description: "Creates or updates a contact on HighLevel. [See the documentation](https://highlevel.stoplight.io/docs/integrations/f71bbdd88f028-upsert-contact)",
|
|
14
|
+
version: "0.0.1",
|
|
15
|
+
type: "action",
|
|
16
|
+
props: {
|
|
17
|
+
app,
|
|
18
|
+
locationId: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
app,
|
|
21
|
+
"locationId",
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
...props,
|
|
25
|
+
},
|
|
26
|
+
async run({ $ }) {
|
|
27
|
+
const {
|
|
28
|
+
app, ...data
|
|
29
|
+
} = this.getData();
|
|
30
|
+
const response = await app.upsertContact({
|
|
31
|
+
$,
|
|
32
|
+
data,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
$.export("$summary", `Successfully upserted contact (ID: ${response?.contact?.id})`);
|
|
36
|
+
return response;
|
|
37
|
+
},
|
|
38
|
+
};
|
package/common/utils.mjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function optionalParseAsJSON(value) {
|
|
2
|
+
try {
|
|
3
|
+
return JSON.parse(value);
|
|
4
|
+
} catch (e) {
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function parseObjectEntries(value) {
|
|
10
|
+
const obj = typeof value === "string"
|
|
11
|
+
? JSON.parse(value)
|
|
12
|
+
: value;
|
|
13
|
+
return Object.fromEntries(
|
|
14
|
+
Object.entries(obj).map(([
|
|
15
|
+
key,
|
|
16
|
+
value,
|
|
17
|
+
]) => [
|
|
18
|
+
key,
|
|
19
|
+
optionalParseAsJSON(value),
|
|
20
|
+
]),
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { axios } from "@pipedream/platform";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
type: "app",
|
|
5
|
+
app: "highlevel_oauth",
|
|
6
|
+
propDefinitions: {
|
|
7
|
+
locationId: {
|
|
8
|
+
type: "string",
|
|
9
|
+
label: "Location ID",
|
|
10
|
+
description: "If not specified, defaults to the authenticated location.",
|
|
11
|
+
optional: true,
|
|
12
|
+
},
|
|
13
|
+
contactId: {
|
|
14
|
+
type: "string",
|
|
15
|
+
label: "Contact ID",
|
|
16
|
+
description: "Search for a contact or provide a custom contact ID",
|
|
17
|
+
useQuery: true,
|
|
18
|
+
async options({ query }) {
|
|
19
|
+
const { contacts } = await this.searchContacts({
|
|
20
|
+
params: {
|
|
21
|
+
query,
|
|
22
|
+
limit: 100,
|
|
23
|
+
locationId: this.getLocationId(),
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
return contacts?.map(({
|
|
27
|
+
id, name, email,
|
|
28
|
+
}) => ({
|
|
29
|
+
label: name ?? email ?? id,
|
|
30
|
+
value: id,
|
|
31
|
+
}));
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
methods: {
|
|
36
|
+
getLocationId() {
|
|
37
|
+
return this.$auth.locationId;
|
|
38
|
+
},
|
|
39
|
+
_baseUrl() {
|
|
40
|
+
return "https://services.leadconnectorhq.com";
|
|
41
|
+
},
|
|
42
|
+
async _makeRequest({
|
|
43
|
+
$ = this,
|
|
44
|
+
headers,
|
|
45
|
+
...otherOpts
|
|
46
|
+
}) {
|
|
47
|
+
return axios($, {
|
|
48
|
+
baseURL: this._baseUrl(),
|
|
49
|
+
headers: {
|
|
50
|
+
...headers,
|
|
51
|
+
"Authorization": `Bearer ${this.$auth.oauth_access_token}`,
|
|
52
|
+
"Version": "2021-07-28",
|
|
53
|
+
},
|
|
54
|
+
...otherOpts,
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
async createContact(args) {
|
|
58
|
+
return this._makeRequest({
|
|
59
|
+
method: "POST",
|
|
60
|
+
url: "/contacts/",
|
|
61
|
+
...args,
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
async updateContact({
|
|
65
|
+
contactId, ...args
|
|
66
|
+
}) {
|
|
67
|
+
return this._makeRequest({
|
|
68
|
+
method: "PUT",
|
|
69
|
+
url: `/contacts/${contactId}`,
|
|
70
|
+
...args,
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
async upsertContact(args) {
|
|
74
|
+
return this._makeRequest({
|
|
75
|
+
method: "POST",
|
|
76
|
+
url: "/contacts/upsert",
|
|
77
|
+
...args,
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
async searchContacts(args) {
|
|
81
|
+
return this._makeRequest({
|
|
82
|
+
url: "/contacts/",
|
|
83
|
+
...args,
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
};
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/highlevel_oauth",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Pipedream HighLevel (OAuth) Components",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "highlevel_oauth.app.mjs",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"pipedream",
|
|
8
8
|
"highlevel_oauth"
|
|
9
9
|
],
|
|
10
|
-
"files": [
|
|
11
|
-
"dist"
|
|
12
|
-
],
|
|
13
10
|
"homepage": "https://pipedream.com/apps/highlevel_oauth",
|
|
14
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
15
12
|
"publishConfig": {
|
|
16
13
|
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@pipedream/platform": "^1.6.2"
|
|
17
17
|
}
|
|
18
18
|
}
|