@pipedream/highlevel_oauth 0.0.1 → 0.2.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/add-contact-to-campaign/add-contact-to-campaign.mjs +36 -0
- package/actions/common/common-contacts.mjs +50 -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/base.mjs +19 -0
- package/common/utils.mjs +22 -0
- package/highlevel_oauth.app.mjs +126 -0
- package/package.json +5 -5
- package/sources/common/base-polling.mjs +25 -0
- package/sources/new-contact-created/new-contact-created.mjs +50 -0
- package/sources/new-contact-created/test-event.mjs +35 -0
- package/sources/new-form-submission/new-form-submission.mjs +59 -0
- package/sources/new-form-submission/test-event.mjs +59 -0
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,36 @@
|
|
|
1
|
+
import common from "../../common/base.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "highlevel_oauth-add-contact-to-campaign",
|
|
6
|
+
name: "Add Contact to Campaign",
|
|
7
|
+
description: "Adds an existing contact to a campaign. [See the documentation](https://highlevel.stoplight.io/docs/integrations/ecf9b5b45deaf-add-contact-to-campaign)",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
...common.props,
|
|
12
|
+
contactId: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
common.props.app,
|
|
15
|
+
"contactId",
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
campaignId: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
common.props.app,
|
|
21
|
+
"campaignId",
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
async run({ $ }) {
|
|
26
|
+
const response = await this.app.addContactToCampaign({
|
|
27
|
+
$,
|
|
28
|
+
contactId: this.contactId,
|
|
29
|
+
campaignId: this.campaignId,
|
|
30
|
+
});
|
|
31
|
+
if (response?.succeded) {
|
|
32
|
+
$.export("$summary", `Successfully added contact to campaign with ID: ${this.campaignId}`);
|
|
33
|
+
}
|
|
34
|
+
return response;
|
|
35
|
+
},
|
|
36
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { parseObjectEntries } from "../../common/utils.mjs";
|
|
2
|
+
import common from "../../common/base.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
props: {
|
|
7
|
+
...common.props,
|
|
8
|
+
name: {
|
|
9
|
+
type: "string",
|
|
10
|
+
label: "Name",
|
|
11
|
+
description: "Full name of the contact, e.g. `Rosan Deo`",
|
|
12
|
+
optional: true,
|
|
13
|
+
},
|
|
14
|
+
email: {
|
|
15
|
+
type: "string",
|
|
16
|
+
label: "Email",
|
|
17
|
+
description: "Email of the contact, e.g. `rosan@deos.com`",
|
|
18
|
+
optional: true,
|
|
19
|
+
},
|
|
20
|
+
phone: {
|
|
21
|
+
type: "string",
|
|
22
|
+
label: "Phone Number",
|
|
23
|
+
description: "Phone number of the contact, e.g. `+1 888-888-8888`",
|
|
24
|
+
optional: true,
|
|
25
|
+
},
|
|
26
|
+
additionalOptions: {
|
|
27
|
+
type: "object",
|
|
28
|
+
label: "Additional Options",
|
|
29
|
+
description:
|
|
30
|
+
"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.",
|
|
31
|
+
optional: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
methods: {
|
|
35
|
+
...common.methods,
|
|
36
|
+
getData(useLocation = true) {
|
|
37
|
+
const {
|
|
38
|
+
app, additionalOptions, locationId, ...data
|
|
39
|
+
} = this;
|
|
40
|
+
return {
|
|
41
|
+
app,
|
|
42
|
+
...(useLocation && {
|
|
43
|
+
locationId: locationId ?? app.getLocationId(),
|
|
44
|
+
}),
|
|
45
|
+
...data,
|
|
46
|
+
...(additionalOptions && parseObjectEntries(additionalOptions)),
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import common from "../common/common-contacts.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.2",
|
|
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-contacts.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.2",
|
|
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-contacts.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.2",
|
|
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/base.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ConfigurationError } from "@pipedream/platform";
|
|
2
|
+
import app from "../highlevel_oauth.app.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
props: {
|
|
6
|
+
app: {
|
|
7
|
+
...app,
|
|
8
|
+
reloadProps: true,
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
async additionalProps() {
|
|
12
|
+
const locationId = this.app.getLocationId();
|
|
13
|
+
if (!locationId) {
|
|
14
|
+
throw new ConfigurationError("This component requires you to authenticate as a **location**, not as an agency/company. *(`locationId` field is missing from `$auth`)*");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return {};
|
|
18
|
+
},
|
|
19
|
+
};
|
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,126 @@
|
|
|
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
|
+
campaignId: {
|
|
35
|
+
type: "string",
|
|
36
|
+
label: "Campaign ID",
|
|
37
|
+
description: "The ID of the campaign to add contact to",
|
|
38
|
+
async options() {
|
|
39
|
+
const { campaigns } = await this.listCampaigns({
|
|
40
|
+
params: {
|
|
41
|
+
locationId: this.getLocationId(),
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
return campaigns?.map(({
|
|
45
|
+
id: value, name: label,
|
|
46
|
+
}) => ({
|
|
47
|
+
label,
|
|
48
|
+
value,
|
|
49
|
+
})) || [];
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
methods: {
|
|
54
|
+
getLocationId() {
|
|
55
|
+
return this.$auth.locationId;
|
|
56
|
+
},
|
|
57
|
+
_baseUrl() {
|
|
58
|
+
return "https://services.leadconnectorhq.com";
|
|
59
|
+
},
|
|
60
|
+
_makeRequest({
|
|
61
|
+
$ = this,
|
|
62
|
+
headers,
|
|
63
|
+
...otherOpts
|
|
64
|
+
}) {
|
|
65
|
+
return axios($, {
|
|
66
|
+
baseURL: this._baseUrl(),
|
|
67
|
+
headers: {
|
|
68
|
+
...headers,
|
|
69
|
+
"Authorization": `Bearer ${this.$auth.oauth_access_token}`,
|
|
70
|
+
"Version": "2021-07-28",
|
|
71
|
+
},
|
|
72
|
+
...otherOpts,
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
createContact(args = {}) {
|
|
76
|
+
return this._makeRequest({
|
|
77
|
+
method: "POST",
|
|
78
|
+
url: "/contacts/",
|
|
79
|
+
...args,
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
updateContact({
|
|
83
|
+
contactId, ...args
|
|
84
|
+
}) {
|
|
85
|
+
return this._makeRequest({
|
|
86
|
+
method: "PUT",
|
|
87
|
+
url: `/contacts/${contactId}`,
|
|
88
|
+
...args,
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
upsertContact(args = {}) {
|
|
92
|
+
return this._makeRequest({
|
|
93
|
+
method: "POST",
|
|
94
|
+
url: "/contacts/upsert",
|
|
95
|
+
...args,
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
searchContacts(args = {}) {
|
|
99
|
+
return this._makeRequest({
|
|
100
|
+
url: "/contacts/",
|
|
101
|
+
...args,
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
listCampaigns(args = {}) {
|
|
105
|
+
return this._makeRequest({
|
|
106
|
+
url: "/campaigns/",
|
|
107
|
+
...args,
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
listFormSubmissions(args = {}) {
|
|
111
|
+
return this._makeRequest({
|
|
112
|
+
url: "/forms/submissions",
|
|
113
|
+
...args,
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
addContactToCampaign({
|
|
117
|
+
contactId, campaignId, ...args
|
|
118
|
+
}) {
|
|
119
|
+
return this._makeRequest({
|
|
120
|
+
method: "POST",
|
|
121
|
+
url: `/contacts/${contactId}/campaigns/${campaignId}`,
|
|
122
|
+
...args,
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
};
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/highlevel_oauth",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.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": "^3.0.3"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import common from "../../common/base.mjs";
|
|
2
|
+
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
props: {
|
|
7
|
+
...common.props,
|
|
8
|
+
db: "$.service.db",
|
|
9
|
+
timer: {
|
|
10
|
+
type: "$.interface.timer",
|
|
11
|
+
default: {
|
|
12
|
+
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
methods: {
|
|
17
|
+
...common.methods,
|
|
18
|
+
_getLastDate() {
|
|
19
|
+
return this.db.get("lastDate");
|
|
20
|
+
},
|
|
21
|
+
_setLastDate(lastDate) {
|
|
22
|
+
this.db.set("lastDate", lastDate);
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import common from "../common/base-polling.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "highlevel_oauth-new-contact-created",
|
|
7
|
+
name: "New Contact Created",
|
|
8
|
+
description: "Emit new event when a new contact is created. [See the documentation](https://highlevel.stoplight.io/docs/integrations/ab55933a57f6f-get-contacts)",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
methods: {
|
|
13
|
+
...common.methods,
|
|
14
|
+
generateMeta(contact) {
|
|
15
|
+
return {
|
|
16
|
+
id: contact.id,
|
|
17
|
+
summary: `New Contact ID: ${contact.id}`,
|
|
18
|
+
ts: Date.parse(contact.dateAdded),
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
async run() {
|
|
23
|
+
const results = [];
|
|
24
|
+
const params = {
|
|
25
|
+
limit: 100,
|
|
26
|
+
startAfter: this._getLastDate(),
|
|
27
|
+
locationId: this.app.getLocationId(),
|
|
28
|
+
};
|
|
29
|
+
let total;
|
|
30
|
+
|
|
31
|
+
do {
|
|
32
|
+
const {
|
|
33
|
+
contacts, meta,
|
|
34
|
+
} = await this.app.searchContacts({
|
|
35
|
+
params,
|
|
36
|
+
});
|
|
37
|
+
results.push(...contacts);
|
|
38
|
+
params.startAfter = meta?.startAfter;
|
|
39
|
+
total = meta?.total;
|
|
40
|
+
} while (results.length < total);
|
|
41
|
+
|
|
42
|
+
this._setLastDate(params.startAfter);
|
|
43
|
+
|
|
44
|
+
results.forEach((contact) => {
|
|
45
|
+
const meta = this.generateMeta(contact);
|
|
46
|
+
this.$emit(contact, meta);
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
sampleEmit,
|
|
50
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"id": "jLxz55idEps7XRAgsWMz",
|
|
3
|
+
"locationId": "t8lsEHvfdlZugCobd4t7",
|
|
4
|
+
"contactName": "(example) casey morgan",
|
|
5
|
+
"firstName": "(example) casey",
|
|
6
|
+
"lastName": "morgan",
|
|
7
|
+
"firstNameRaw": "(Example) Casey",
|
|
8
|
+
"lastNameRaw": "Morgan",
|
|
9
|
+
"companyName": "(Example) Dunder Mifflin",
|
|
10
|
+
"email": null,
|
|
11
|
+
"phone": "+16541234567",
|
|
12
|
+
"dnd": false,
|
|
13
|
+
"dndSettings": {},
|
|
14
|
+
"type": "lead",
|
|
15
|
+
"source": null,
|
|
16
|
+
"assignedTo": null,
|
|
17
|
+
"city": null,
|
|
18
|
+
"state": null,
|
|
19
|
+
"postalCode": null,
|
|
20
|
+
"address1": null,
|
|
21
|
+
"dateAdded": "2025-04-04T16:00:08.369Z",
|
|
22
|
+
"dateUpdated": "2025-04-04T16:00:12.888Z",
|
|
23
|
+
"dateOfBirth": null,
|
|
24
|
+
"businessId": "67f001fe6b2c160e6f140161",
|
|
25
|
+
"tags": [
|
|
26
|
+
"high priority",
|
|
27
|
+
"follow-up"
|
|
28
|
+
],
|
|
29
|
+
"followers": [],
|
|
30
|
+
"country": "US",
|
|
31
|
+
"website": null,
|
|
32
|
+
"timezone": null,
|
|
33
|
+
"additionalEmails": [],
|
|
34
|
+
"customFields": []
|
|
35
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import common from "../common/base-polling.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "highlevel_oauth-new-form-submission",
|
|
7
|
+
name: "New Form Submission",
|
|
8
|
+
description: "Emit new event when a new form submission is created. [See the documentation](https://highlevel.stoplight.io/docs/integrations/a6114bd7685d1-get-forms-submissions)",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
methods: {
|
|
13
|
+
...common.methods,
|
|
14
|
+
generateMeta(submission) {
|
|
15
|
+
return {
|
|
16
|
+
id: submission.id,
|
|
17
|
+
summary: `New Submission ID: ${submission.id}`,
|
|
18
|
+
ts: Date.parse(submission.createdAt),
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
async run() {
|
|
23
|
+
const lastDate = this._getLastDate();
|
|
24
|
+
let maxDate = lastDate;
|
|
25
|
+
|
|
26
|
+
const results = [];
|
|
27
|
+
const params = {
|
|
28
|
+
limit: 100,
|
|
29
|
+
page: 1,
|
|
30
|
+
startAt: lastDate,
|
|
31
|
+
locationId: this.app.getLocationId(),
|
|
32
|
+
};
|
|
33
|
+
let total;
|
|
34
|
+
|
|
35
|
+
do {
|
|
36
|
+
const {
|
|
37
|
+
submissions = [], meta,
|
|
38
|
+
} = await this.app.listFormSubmissions({
|
|
39
|
+
params,
|
|
40
|
+
});
|
|
41
|
+
for (const submission of submissions) {
|
|
42
|
+
results.push(submission);
|
|
43
|
+
if (!maxDate || Date.parse(submission.createdAt) > Date.parse(maxDate)) {
|
|
44
|
+
maxDate = submission.createdAt.slice(0, 10);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
total = meta?.total;
|
|
48
|
+
params.page++;
|
|
49
|
+
} while (results.length < total);
|
|
50
|
+
|
|
51
|
+
this._setLastDate(maxDate);
|
|
52
|
+
|
|
53
|
+
results.forEach((submission) => {
|
|
54
|
+
const meta = this.generateMeta(submission);
|
|
55
|
+
this.$emit(submission, meta);
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
sampleEmit,
|
|
59
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"id": "67f029b5735c5378f6ba3b8a",
|
|
3
|
+
"contactId": "2N41CyHhuw4dUROfablK",
|
|
4
|
+
"formId": "AhRYrvMdMFRmZ7GxDlDS",
|
|
5
|
+
"name": "",
|
|
6
|
+
"email": "email@email.com",
|
|
7
|
+
"others": {
|
|
8
|
+
"first_name": "",
|
|
9
|
+
"last_name": "",
|
|
10
|
+
"phone": "",
|
|
11
|
+
"email": "email@email.com",
|
|
12
|
+
"terms_and_conditions": "By checking this box, I consent to receive transactional messages related to my account, orders, or services I have requested. These messages may include appointment reminders, order confirmations, and account notifications among others. Message frequency may vary. Message & Data rates may apply.Reply HELP for help or STOP to opt-out.; By checking this box, I consent to receive marketing and promotional messages, including special offers, discounts, new product updates among others. Message frequency may vary. Message & Data rates may apply. Reply HELP for help or STOP to opt-out.",
|
|
13
|
+
"formId": "AhRYrvMdMFRmZ7GxDlDS",
|
|
14
|
+
"location_id": "t8lsEHvfdlZugCobd4t7",
|
|
15
|
+
"sessionId": "59cdf305-4ac2-402d-bdbd-6e1e99be33cc",
|
|
16
|
+
"eventData": {
|
|
17
|
+
"source": "Direct traffic",
|
|
18
|
+
"referrer": "https://app.gohighlevel.com",
|
|
19
|
+
"adSource": "",
|
|
20
|
+
"page": {
|
|
21
|
+
"url": "https://link.apisystem.tech/widget/form/AhRYrvMdMFRmZ7GxDlDS",
|
|
22
|
+
"title": ""
|
|
23
|
+
},
|
|
24
|
+
"timestamp": 1743792563661,
|
|
25
|
+
"contactSessionIds": {
|
|
26
|
+
"ids": [
|
|
27
|
+
"59cdf305-4ac2-402d-bdbd-6e1e99be33cc"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"fbp": "",
|
|
31
|
+
"fbc": "",
|
|
32
|
+
"type": "page-visit",
|
|
33
|
+
"parentId": "AhRYrvMdMFRmZ7GxDlDS",
|
|
34
|
+
"pageVisitType": "form",
|
|
35
|
+
"domain": "link.apisystem.tech",
|
|
36
|
+
"version": "v3",
|
|
37
|
+
"parentName": "Form 0",
|
|
38
|
+
"fingerprint": null,
|
|
39
|
+
"documentURL": "https://link.apisystem.tech/widget/form/AhRYrvMdMFRmZ7GxDlDS",
|
|
40
|
+
"fbEventId": "024451af-ea45-4e6e-8b83-3385fb5eaff1",
|
|
41
|
+
"medium": "form",
|
|
42
|
+
"mediumId": "AhRYrvMdMFRmZ7GxDlDS"
|
|
43
|
+
},
|
|
44
|
+
"Timezone": "America/Detroit (GMT-04:00)",
|
|
45
|
+
"fieldsOriSequance": [
|
|
46
|
+
"first_name",
|
|
47
|
+
"last_name",
|
|
48
|
+
"phone",
|
|
49
|
+
"email",
|
|
50
|
+
"terms_and_conditions",
|
|
51
|
+
"button",
|
|
52
|
+
"header"
|
|
53
|
+
],
|
|
54
|
+
"submissionId": "4e3e3cef-2ed9-421e-b939-2200e68ec3e8",
|
|
55
|
+
"signatureHash": "U2FsdGVkX1+dZ1Qwj2YqgNrQ7WORnn2C2oJMM2gicn1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