@xapp/stentor-service-boberdoo 1.80.3 → 1.81.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/lib/BoberdooIntegration.d.ts +74 -8
- package/lib/BoberdooIntegration.js +203 -82
- package/lib/BoberdooIntegration.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib/models.d.ts +75 -25
- package/package.json +5 -3
|
@@ -1,23 +1,89 @@
|
|
|
1
|
-
import { CrmResponse, ExternalLead } from "stentor-models";
|
|
1
|
+
import { CrmResponse, CrmService, CrmServiceAvailability, CrmServiceAvailabilityOptions, CrmServiceJobType, DateTimeRange, ExternalLead } from "stentor-models";
|
|
2
2
|
import { BoberdooExtras, BoberdooLeadPayload, BoberdooResponse, BoberdooServiceProps } from "./models";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Posting endpoint for PCM Growth's LeadPortal/Boberdoo install. Exported
|
|
5
|
+
* so callers can opt in explicitly via `BoberdooServiceProps.apiEndpoint`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PCM_GROWTH_LEADPORTAL_ENDPOINT = "https://pcmgrowth.leadportal.com/apiJSON.php";
|
|
8
|
+
/**
|
|
9
|
+
* Describes the HTTP request that should be posted to the partner.
|
|
10
|
+
* Stateless callers (e.g. stentor-api's chain runner) execute the
|
|
11
|
+
* request themselves so they can capture it for audit logging.
|
|
5
12
|
*
|
|
6
|
-
*
|
|
13
|
+
* SECURITY: `body.Request.Key` is the partner API credential. Callers
|
|
14
|
+
* that audit-log this descriptor must redact `Request.Key` before
|
|
15
|
+
* persisting the body.
|
|
7
16
|
*/
|
|
8
|
-
export
|
|
17
|
+
export interface BoberdooRequestDescriptor {
|
|
18
|
+
url: string;
|
|
19
|
+
method: "POST";
|
|
20
|
+
headers: Record<string, string>;
|
|
21
|
+
body: {
|
|
22
|
+
Request: BoberdooLeadPayload;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Builds the JSON request that should be POSTed to the partner.
|
|
27
|
+
*
|
|
28
|
+
* Stateless and side-effect free — callers can execute the request
|
|
29
|
+
* themselves (e.g. through a chain runner that performs audit logging)
|
|
30
|
+
* and pass the response body to `parseBoberdooResponse`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function buildBoberdooRequest(props: BoberdooServiceProps, externalLead: ExternalLead, extras?: BoberdooExtras): BoberdooRequestDescriptor;
|
|
33
|
+
/**
|
|
34
|
+
* Parses a response body returned by the partner into a structured
|
|
35
|
+
* `BoberdooResponse`. Stateless — callers that execute the HTTP request
|
|
36
|
+
* themselves pass the raw response body here.
|
|
37
|
+
*/
|
|
38
|
+
export declare function parseBoberdooResponse(responseBody: unknown): BoberdooResponse;
|
|
39
|
+
/**
|
|
40
|
+
* BoberdooIntegration posts leads to a LeadPortal/Boberdoo lead distribution
|
|
41
|
+
* platform using the `pingPostLead` action in full mode.
|
|
42
|
+
*
|
|
43
|
+
* Boberdoo is a lead-distribution service rather than a true CRM, so the
|
|
44
|
+
* `getAvailability` and `getJobType` methods are stubbed: availability is
|
|
45
|
+
* always unlimited and job type matching is not performed. The interface
|
|
46
|
+
* is implemented so consumers can treat it uniformly with other CRMs.
|
|
47
|
+
*
|
|
48
|
+
* @see https://pcmgrowth.leadportal.com/new_api/index.php?action=detail&func=pingPostLead&TYPE=33
|
|
49
|
+
*/
|
|
50
|
+
export declare class BoberdooIntegration implements CrmService {
|
|
9
51
|
private props;
|
|
10
|
-
private apiEndpoint;
|
|
11
52
|
constructor(props: BoberdooServiceProps);
|
|
12
53
|
/**
|
|
13
|
-
* Posts a lead to
|
|
54
|
+
* Posts a lead to the partner.
|
|
55
|
+
*
|
|
56
|
+
* Returns a `CrmResponse`:
|
|
57
|
+
* - `status: "Success"` covers both `Matched` (lead created and sold)
|
|
58
|
+
* and `Unmatched` (lead created, no buyer). The raw partner status
|
|
59
|
+
* is surfaced in `message` so callers can distinguish the two.
|
|
60
|
+
* - `refId` is populated with the partner's `lead_id` when present.
|
|
61
|
+
* - `status: "Failure"` indicates a rejected post (partner returned
|
|
62
|
+
* `Error`, network failure, or unparseable body). `message` carries
|
|
63
|
+
* the partner's error string when available.
|
|
14
64
|
*
|
|
15
65
|
* @param externalLead - The lead data from the contact capture handler
|
|
16
66
|
* @param extras - Optional extra fields including TrustedForm cert URL and UTM params
|
|
17
67
|
*/
|
|
18
68
|
send(externalLead: ExternalLead, extras?: BoberdooExtras): Promise<CrmResponse>;
|
|
19
69
|
/**
|
|
20
|
-
*
|
|
70
|
+
* Boberdoo is a lead-distribution platform with no concept of
|
|
71
|
+
* appointment availability, so this stub returns full availability
|
|
72
|
+
* for the requested range — matching the convention used by other
|
|
73
|
+
* stentor CRM services that don't expose a scheduling API.
|
|
74
|
+
*/
|
|
75
|
+
getAvailability(range: DateTimeRange, options?: CrmServiceAvailabilityOptions): Promise<CrmServiceAvailability>;
|
|
76
|
+
/**
|
|
77
|
+
* Boberdoo does not surface job-type classification on the lead;
|
|
78
|
+
* the partner's matching system handles that on their side.
|
|
79
|
+
*/
|
|
80
|
+
getJobType(message: string, externalLead?: ExternalLead): Promise<CrmServiceJobType>;
|
|
81
|
+
/**
|
|
82
|
+
* Builds the descriptor, executes it via axios, and parses the body.
|
|
83
|
+
* Kept protected so subclasses can override the transport, but most
|
|
84
|
+
* consumers should use the exported `buildBoberdooRequest` /
|
|
85
|
+
* `parseBoberdooResponse` helpers directly to plug into their own
|
|
86
|
+
* transport / audit pipeline.
|
|
21
87
|
*/
|
|
22
|
-
protected post(
|
|
88
|
+
protected post(externalLead: ExternalLead, extras?: BoberdooExtras): Promise<BoberdooResponse>;
|
|
23
89
|
}
|
|
@@ -12,82 +12,185 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.BoberdooIntegration = void 0;
|
|
15
|
+
exports.BoberdooIntegration = exports.PCM_GROWTH_LEADPORTAL_ENDPOINT = void 0;
|
|
16
|
+
exports.buildBoberdooRequest = buildBoberdooRequest;
|
|
17
|
+
exports.parseBoberdooResponse = parseBoberdooResponse;
|
|
16
18
|
/*! Copyright (c) 2026, XAPP AI */
|
|
17
19
|
const stentor_logger_1 = require("stentor-logger");
|
|
18
20
|
const axios_1 = __importDefault(require("axios"));
|
|
19
|
-
const DEFAULT_API_ENDPOINT = "https://www.boberdoo.com/index.php";
|
|
20
21
|
/**
|
|
21
|
-
*
|
|
22
|
+
* Posting endpoint for PCM Growth's LeadPortal/Boberdoo install. Exported
|
|
23
|
+
* so callers can opt in explicitly via `BoberdooServiceProps.apiEndpoint`.
|
|
24
|
+
*/
|
|
25
|
+
exports.PCM_GROWTH_LEADPORTAL_ENDPOINT = "https://pcmgrowth.leadportal.com/apiJSON.php";
|
|
26
|
+
// Partner-provided zip that routes the lead to a test partner so test
|
|
27
|
+
// posts come back Matched without billing a real buyer.
|
|
28
|
+
const TEST_ZIP = "99999";
|
|
29
|
+
/**
|
|
30
|
+
* Splits a `FULL_NAME` value into first and last names. Uses the
|
|
31
|
+
* "first token is the first name, everything else is the last name"
|
|
32
|
+
* convention — e.g. `"Mary Jane Watson"` → `first="Mary"`, `last="Jane Watson"`.
|
|
33
|
+
*
|
|
34
|
+
* Kept inline so each service can call it without a cross-package
|
|
35
|
+
* dependency; mirror this same function in any sibling service so a
|
|
36
|
+
* single lead always produces the same wire name across CRMs.
|
|
37
|
+
*/
|
|
38
|
+
function splitFullName(fullName) {
|
|
39
|
+
const parts = fullName.trim().split(/\s+/);
|
|
40
|
+
return {
|
|
41
|
+
firstName: parts[0],
|
|
42
|
+
lastName: parts.slice(1).join(" ") || undefined
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Builds the JSON request that should be POSTed to the partner.
|
|
22
47
|
*
|
|
23
|
-
*
|
|
48
|
+
* Stateless and side-effect free — callers can execute the request
|
|
49
|
+
* themselves (e.g. through a chain runner that performs audit logging)
|
|
50
|
+
* and pass the response body to `parseBoberdooResponse`.
|
|
51
|
+
*/
|
|
52
|
+
function buildBoberdooRequest(props, externalLead, extras) {
|
|
53
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
54
|
+
const firstName = (_a = externalLead.fields.find((f) => f.name === "FIRST_NAME")) === null || _a === void 0 ? void 0 : _a.value;
|
|
55
|
+
const lastName = (_b = externalLead.fields.find((f) => f.name === "LAST_NAME")) === null || _b === void 0 ? void 0 : _b.value;
|
|
56
|
+
const fullName = (_c = externalLead.fields.find((f) => f.name === "FULL_NAME")) === null || _c === void 0 ? void 0 : _c.value;
|
|
57
|
+
const phone = (_d = externalLead.fields.find((f) => f.name === "PHONE")) === null || _d === void 0 ? void 0 : _d.value;
|
|
58
|
+
const email = (_e = externalLead.fields.find((f) => f.name === "EMAIL")) === null || _e === void 0 ? void 0 : _e.value;
|
|
59
|
+
const address = (_f = externalLead.fields.find((f) => f.name === "ADDRESS")) === null || _f === void 0 ? void 0 : _f.value;
|
|
60
|
+
const city = (_g = externalLead.fields.find((f) => f.name === "CITY")) === null || _g === void 0 ? void 0 : _g.value;
|
|
61
|
+
const state = (_h = externalLead.fields.find((f) => f.name === "STATE")) === null || _h === void 0 ? void 0 : _h.value;
|
|
62
|
+
const zip = (_j = externalLead.fields.find((f) => f.name === "ZIP")) === null || _j === void 0 ? void 0 : _j.value;
|
|
63
|
+
let resolvedFirstName = firstName;
|
|
64
|
+
let resolvedLastName = lastName;
|
|
65
|
+
if (!resolvedFirstName && fullName) {
|
|
66
|
+
const split = splitFullName(fullName);
|
|
67
|
+
resolvedFirstName = split.firstName;
|
|
68
|
+
resolvedLastName = split.lastName;
|
|
69
|
+
}
|
|
70
|
+
const payload = {
|
|
71
|
+
Format: "JSON",
|
|
72
|
+
Key: props.apiKey,
|
|
73
|
+
API_Action: "pingPostLead",
|
|
74
|
+
Mode: "full",
|
|
75
|
+
TYPE: props.leadType,
|
|
76
|
+
SRC: props.src,
|
|
77
|
+
Landing_Page: props.landingPage
|
|
78
|
+
};
|
|
79
|
+
if (resolvedFirstName)
|
|
80
|
+
payload.First_Name = resolvedFirstName;
|
|
81
|
+
if (resolvedLastName)
|
|
82
|
+
payload.Last_Name = resolvedLastName;
|
|
83
|
+
if (phone)
|
|
84
|
+
payload.Primary_Phone = phone;
|
|
85
|
+
if (email)
|
|
86
|
+
payload.Email = email;
|
|
87
|
+
if (address)
|
|
88
|
+
payload.Address = address;
|
|
89
|
+
if (city)
|
|
90
|
+
payload.City = city;
|
|
91
|
+
if (state)
|
|
92
|
+
payload.State = state;
|
|
93
|
+
if (zip)
|
|
94
|
+
payload.Zip = zip;
|
|
95
|
+
if (extras === null || extras === void 0 ? void 0 : extras.xxTrustedFormCertUrl)
|
|
96
|
+
payload.Trusted_Form_URL = extras.xxTrustedFormCertUrl;
|
|
97
|
+
if (extras === null || extras === void 0 ? void 0 : extras.utm_source)
|
|
98
|
+
payload.utm_source = extras.utm_source;
|
|
99
|
+
if (extras === null || extras === void 0 ? void 0 : extras.utm_campaign)
|
|
100
|
+
payload.utm_campaign = extras.utm_campaign;
|
|
101
|
+
if (extras === null || extras === void 0 ? void 0 : extras.utm_medium)
|
|
102
|
+
payload.utm_medium = extras.utm_medium;
|
|
103
|
+
if (extras === null || extras === void 0 ? void 0 : extras.utm_content)
|
|
104
|
+
payload.utm_content = extras.utm_content;
|
|
105
|
+
if (extras === null || extras === void 0 ? void 0 : extras.utm_term)
|
|
106
|
+
payload.utm_term = extras.utm_term;
|
|
107
|
+
if (props.testMode) {
|
|
108
|
+
payload.Test_Lead = "1";
|
|
109
|
+
// Support directive: in test mode override the zip to TEST_ZIP
|
|
110
|
+
// so the lead is guaranteed to route to the partner's test
|
|
111
|
+
// buyer and come back Matched.
|
|
112
|
+
payload.Zip = TEST_ZIP;
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
url: props.apiEndpoint,
|
|
116
|
+
method: "POST",
|
|
117
|
+
headers: { "Content-Type": "application/json" },
|
|
118
|
+
body: { Request: payload }
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Parses a response body returned by the partner into a structured
|
|
123
|
+
* `BoberdooResponse`. Stateless — callers that execute the HTTP request
|
|
124
|
+
* themselves pass the raw response body here.
|
|
125
|
+
*/
|
|
126
|
+
function parseBoberdooResponse(responseBody) {
|
|
127
|
+
const result = { status: "Failure" };
|
|
128
|
+
const inner = responseBody === null || responseBody === void 0 ? void 0 : responseBody.response;
|
|
129
|
+
const rawStatus = inner === null || inner === void 0 ? void 0 : inner.status;
|
|
130
|
+
if (rawStatus === "Matched" || rawStatus === "Unmatched") {
|
|
131
|
+
result.status = "Success";
|
|
132
|
+
result.rawStatus = rawStatus;
|
|
133
|
+
result.leadId = inner === null || inner === void 0 ? void 0 : inner.lead_id;
|
|
134
|
+
result.price = inner === null || inner === void 0 ? void 0 : inner.price;
|
|
135
|
+
result.data = responseBody;
|
|
136
|
+
}
|
|
137
|
+
else if (rawStatus === "Error") {
|
|
138
|
+
result.rawStatus = "Error";
|
|
139
|
+
result.error = (inner === null || inner === void 0 ? void 0 : inner.error) || "Boberdoo returned Error status";
|
|
140
|
+
result.data = responseBody;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
result.error = (inner === null || inner === void 0 ? void 0 : inner.error) || `Unexpected response from Boberdoo: ${JSON.stringify(responseBody)}`;
|
|
144
|
+
result.data = responseBody;
|
|
145
|
+
}
|
|
146
|
+
return result;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* BoberdooIntegration posts leads to a LeadPortal/Boberdoo lead distribution
|
|
150
|
+
* platform using the `pingPostLead` action in full mode.
|
|
151
|
+
*
|
|
152
|
+
* Boberdoo is a lead-distribution service rather than a true CRM, so the
|
|
153
|
+
* `getAvailability` and `getJobType` methods are stubbed: availability is
|
|
154
|
+
* always unlimited and job type matching is not performed. The interface
|
|
155
|
+
* is implemented so consumers can treat it uniformly with other CRMs.
|
|
156
|
+
*
|
|
157
|
+
* @see https://pcmgrowth.leadportal.com/new_api/index.php?action=detail&func=pingPostLead&TYPE=33
|
|
24
158
|
*/
|
|
25
159
|
class BoberdooIntegration {
|
|
26
160
|
constructor(props) {
|
|
27
161
|
this.props = props;
|
|
28
|
-
this.apiEndpoint = props.apiEndpoint || DEFAULT_API_ENDPOINT;
|
|
29
162
|
}
|
|
30
163
|
/**
|
|
31
|
-
* Posts a lead to
|
|
164
|
+
* Posts a lead to the partner.
|
|
165
|
+
*
|
|
166
|
+
* Returns a `CrmResponse`:
|
|
167
|
+
* - `status: "Success"` covers both `Matched` (lead created and sold)
|
|
168
|
+
* and `Unmatched` (lead created, no buyer). The raw partner status
|
|
169
|
+
* is surfaced in `message` so callers can distinguish the two.
|
|
170
|
+
* - `refId` is populated with the partner's `lead_id` when present.
|
|
171
|
+
* - `status: "Failure"` indicates a rejected post (partner returned
|
|
172
|
+
* `Error`, network failure, or unparseable body). `message` carries
|
|
173
|
+
* the partner's error string when available.
|
|
32
174
|
*
|
|
33
175
|
* @param externalLead - The lead data from the contact capture handler
|
|
34
176
|
* @param extras - Optional extra fields including TrustedForm cert URL and UTM params
|
|
35
177
|
*/
|
|
36
178
|
send(externalLead, extras) {
|
|
37
179
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
39
180
|
const crmResponse = {
|
|
40
181
|
status: "Failure",
|
|
41
182
|
message: ""
|
|
42
183
|
};
|
|
43
184
|
try {
|
|
44
|
-
const
|
|
45
|
-
const lastName = (_b = externalLead.fields.find((f) => f.name === "LAST_NAME")) === null || _b === void 0 ? void 0 : _b.value;
|
|
46
|
-
const fullName = (_c = externalLead.fields.find((f) => f.name === "FULL_NAME")) === null || _c === void 0 ? void 0 : _c.value;
|
|
47
|
-
const phone = (_d = externalLead.fields.find((f) => f.name === "PHONE")) === null || _d === void 0 ? void 0 : _d.value;
|
|
48
|
-
const email = (_e = externalLead.fields.find((f) => f.name === "EMAIL")) === null || _e === void 0 ? void 0 : _e.value;
|
|
49
|
-
const address = (_f = externalLead.fields.find((f) => f.name === "ADDRESS")) === null || _f === void 0 ? void 0 : _f.value;
|
|
50
|
-
const city = (_g = externalLead.fields.find((f) => f.name === "CITY")) === null || _g === void 0 ? void 0 : _g.value;
|
|
51
|
-
const state = (_h = externalLead.fields.find((f) => f.name === "STATE")) === null || _h === void 0 ? void 0 : _h.value;
|
|
52
|
-
const zip = (_j = externalLead.fields.find((f) => f.name === "ZIP")) === null || _j === void 0 ? void 0 : _j.value;
|
|
53
|
-
let resolvedFirstName = firstName;
|
|
54
|
-
let resolvedLastName = lastName;
|
|
55
|
-
if (!resolvedFirstName && fullName) {
|
|
56
|
-
const parts = fullName.trim().split(/\s+/);
|
|
57
|
-
resolvedFirstName = parts[0];
|
|
58
|
-
resolvedLastName = parts.slice(1).join(" ") || undefined;
|
|
59
|
-
}
|
|
60
|
-
const payload = {
|
|
61
|
-
lp_campaign_id: this.props.campaignId,
|
|
62
|
-
lp_campaign_key: this.props.campaignKey,
|
|
63
|
-
lp_response: "json"
|
|
64
|
-
};
|
|
65
|
-
if (this.props.testMode) {
|
|
66
|
-
payload.lp_test = "test";
|
|
67
|
-
}
|
|
68
|
-
if (resolvedFirstName)
|
|
69
|
-
payload.first_name = resolvedFirstName;
|
|
70
|
-
if (resolvedLastName)
|
|
71
|
-
payload.last_name = resolvedLastName;
|
|
72
|
-
if (phone)
|
|
73
|
-
payload.phone_home = phone;
|
|
74
|
-
if (email)
|
|
75
|
-
payload.email_address = email;
|
|
76
|
-
if (address)
|
|
77
|
-
payload.address = address;
|
|
78
|
-
if (city)
|
|
79
|
-
payload.city = city;
|
|
80
|
-
if (state)
|
|
81
|
-
payload.state = state;
|
|
82
|
-
if (zip)
|
|
83
|
-
payload.zip_code = zip;
|
|
84
|
-
// Include TrustedForm cert URL if present — Boberdoo has native TrustedForm support
|
|
85
|
-
if (extras === null || extras === void 0 ? void 0 : extras.xxTrustedFormCertUrl) {
|
|
86
|
-
payload.xxTrustedFormCertUrl = extras.xxTrustedFormCertUrl;
|
|
87
|
-
}
|
|
88
|
-
const boberdooResponse = yield this.post(payload);
|
|
185
|
+
const boberdooResponse = yield this.post(externalLead, extras);
|
|
89
186
|
if (boberdooResponse.status === "Success") {
|
|
90
187
|
crmResponse.status = "Success";
|
|
188
|
+
if (boberdooResponse.rawStatus) {
|
|
189
|
+
crmResponse.message = boberdooResponse.rawStatus;
|
|
190
|
+
}
|
|
191
|
+
if (boberdooResponse.leadId) {
|
|
192
|
+
crmResponse.refId = boberdooResponse.leadId;
|
|
193
|
+
}
|
|
91
194
|
}
|
|
92
195
|
else {
|
|
93
196
|
crmResponse.message = boberdooResponse.error || "Boberdoo returned a failure response";
|
|
@@ -101,44 +204,62 @@ class BoberdooIntegration {
|
|
|
101
204
|
});
|
|
102
205
|
}
|
|
103
206
|
/**
|
|
104
|
-
*
|
|
207
|
+
* Boberdoo is a lead-distribution platform with no concept of
|
|
208
|
+
* appointment availability, so this stub returns full availability
|
|
209
|
+
* for the requested range — matching the convention used by other
|
|
210
|
+
* stentor CRM services that don't expose a scheduling API.
|
|
105
211
|
*/
|
|
106
|
-
|
|
212
|
+
getAvailability(range,
|
|
213
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
214
|
+
options) {
|
|
107
215
|
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
for (const [key, value] of Object.entries(payload)) {
|
|
113
|
-
if (value !== undefined) {
|
|
114
|
-
body.append(key, value);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
const config = {
|
|
118
|
-
method: "post",
|
|
119
|
-
url: this.apiEndpoint,
|
|
120
|
-
params: { type: "post" },
|
|
121
|
-
headers: {
|
|
122
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
123
|
-
},
|
|
124
|
-
data: body.toString()
|
|
216
|
+
(0, stentor_logger_1.log)().debug(`${this.constructor.name} getAvailability not implemented, returning full availability.`);
|
|
217
|
+
return {
|
|
218
|
+
range,
|
|
219
|
+
unavailabilities: []
|
|
125
220
|
};
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Boberdoo does not surface job-type classification on the lead;
|
|
225
|
+
* the partner's matching system handles that on their side.
|
|
226
|
+
*/
|
|
227
|
+
getJobType(
|
|
228
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
229
|
+
message,
|
|
230
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
231
|
+
externalLead) {
|
|
232
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
233
|
+
(0, stentor_logger_1.log)().debug(`${this.constructor.name} getJobType not implemented, returning no match`);
|
|
234
|
+
return;
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Builds the descriptor, executes it via axios, and parses the body.
|
|
239
|
+
* Kept protected so subclasses can override the transport, but most
|
|
240
|
+
* consumers should use the exported `buildBoberdooRequest` /
|
|
241
|
+
* `parseBoberdooResponse` helpers directly to plug into their own
|
|
242
|
+
* transport / audit pipeline.
|
|
243
|
+
*/
|
|
244
|
+
post(externalLead, extras) {
|
|
245
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
246
|
+
const descriptor = buildBoberdooRequest(this.props, externalLead, extras);
|
|
126
247
|
try {
|
|
127
|
-
const response = yield (0, axios_1.default)(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
boberdooResponse.error = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.error) || "Unexpected response from Boberdoo";
|
|
135
|
-
}
|
|
248
|
+
const response = yield (0, axios_1.default)({
|
|
249
|
+
method: descriptor.method,
|
|
250
|
+
url: descriptor.url,
|
|
251
|
+
headers: descriptor.headers,
|
|
252
|
+
data: descriptor.body
|
|
253
|
+
});
|
|
254
|
+
return parseBoberdooResponse(response.data);
|
|
136
255
|
}
|
|
137
256
|
catch (err) {
|
|
138
257
|
(0, stentor_logger_1.log)().error(`Boberdoo: Error posting lead ${err}`);
|
|
139
|
-
|
|
258
|
+
return {
|
|
259
|
+
status: "Failure",
|
|
260
|
+
error: err instanceof Error ? err.message : String(err)
|
|
261
|
+
};
|
|
140
262
|
}
|
|
141
|
-
return boberdooResponse;
|
|
142
263
|
});
|
|
143
264
|
}
|
|
144
265
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BoberdooIntegration.js","sourceRoot":"","sources":["../src/BoberdooIntegration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"BoberdooIntegration.js","sourceRoot":"","sources":["../src/BoberdooIntegration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAiEA,oDA+DC;AAOD,sDAqBC;AA5JD,kCAAkC;AAClC,mDAAqC;AACrC,kDAA0B;AAa1B;;;GAGG;AACU,QAAA,8BAA8B,GAAG,8CAA8C,CAAC;AAE7F,sEAAsE;AACtE,wDAAwD;AACxD,MAAM,QAAQ,GAAG,OAAO,CAAC;AAEzB;;;;;;;;GAQG;AACH,SAAS,aAAa,CAAC,QAAgB;IACnC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3C,OAAO;QACH,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;QACnB,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,SAAS;KAClD,CAAC;AACN,CAAC;AAkBD;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAChC,KAA2B,EAC3B,YAA0B,EAC1B,MAAuB;;IAEvB,MAAM,SA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;;;;;OAMG;IACa,IAAI,CAAC,YAA0B,EAAE,MAAuB;;YACpE,MAAM,UAAU,GAAG,oBAAoB,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;YAE1E,IAAI,CAAC;gBACD,MAAM,QAAQ,GAAG,MAAM,IAAA,eAAK,EAAC;oBACzB,MAAM,EAAE,UAAU,CAAC,MAAM;oBACzB,GAAG,EAAE,UAAU,CAAC,GAAG;oBACnB,OAAO,EAAE,UAAU,CAAC,OAAO;oBAC3B,IAAI,EAAE,UAAU,CAAC,IAAI;iBACxB,CAAC,CAAC;gBACH,OAAO,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAChD,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACX,IAAA,oBAAG,GAAE,CAAC,KAAK,CAAC,gCAAgC,GAAG,EAAE,CAAC,CAAC;gBACnD,OAAO;oBACH,MAAM,EAAE,SAAS;oBACjB,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;iBAC1D,CAAC;YACN,CAAC;QACL,CAAC;KAAA;CACJ;AA5GD,kDA4GC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright (c) 2026, XAPP AI */
|
|
2
|
-
export { BoberdooIntegration } from "./BoberdooIntegration";
|
|
2
|
+
export { BoberdooIntegration, BoberdooRequestDescriptor, PCM_GROWTH_LEADPORTAL_ENDPOINT, buildBoberdooRequest, parseBoberdooResponse } from "./BoberdooIntegration";
|
|
3
3
|
export * from "./models";
|
package/lib/index.js
CHANGED
|
@@ -14,9 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.BoberdooIntegration = void 0;
|
|
17
|
+
exports.parseBoberdooResponse = exports.buildBoberdooRequest = exports.PCM_GROWTH_LEADPORTAL_ENDPOINT = exports.BoberdooIntegration = void 0;
|
|
18
18
|
/*! Copyright (c) 2026, XAPP AI */
|
|
19
19
|
var BoberdooIntegration_1 = require("./BoberdooIntegration");
|
|
20
20
|
Object.defineProperty(exports, "BoberdooIntegration", { enumerable: true, get: function () { return BoberdooIntegration_1.BoberdooIntegration; } });
|
|
21
|
+
Object.defineProperty(exports, "PCM_GROWTH_LEADPORTAL_ENDPOINT", { enumerable: true, get: function () { return BoberdooIntegration_1.PCM_GROWTH_LEADPORTAL_ENDPOINT; } });
|
|
22
|
+
Object.defineProperty(exports, "buildBoberdooRequest", { enumerable: true, get: function () { return BoberdooIntegration_1.buildBoberdooRequest; } });
|
|
23
|
+
Object.defineProperty(exports, "parseBoberdooResponse", { enumerable: true, get: function () { return BoberdooIntegration_1.parseBoberdooResponse; } });
|
|
21
24
|
__exportStar(require("./models"), exports);
|
|
22
25
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAkC;AAClC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAkC;AAClC,6DAM+B;AAL3B,0HAAA,mBAAmB,OAAA;AAEnB,qIAAA,8BAA8B,OAAA;AAC9B,2HAAA,oBAAoB,OAAA;AACpB,4HAAA,qBAAqB,OAAA;AAEzB,2CAAyB"}
|
package/lib/models.d.ts
CHANGED
|
@@ -1,48 +1,98 @@
|
|
|
1
1
|
/*! Copyright (c) 2026, XAPP AI */
|
|
2
2
|
export interface BoberdooServiceProps {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* API key issued by the partner. Sent as `Key` in the request body.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
apiKey: string;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Numeric lead type / vertical ID for the partner (`TYPE` in the request).
|
|
9
|
+
* For PCM Growth Home Improvement this is "33".
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
+
leadType: string;
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
+
* Source identifier assigned by the partner (`SRC`).
|
|
14
|
+
* For our integration this is "Xapp".
|
|
13
15
|
*/
|
|
14
|
-
|
|
16
|
+
src: string;
|
|
15
17
|
/**
|
|
16
|
-
*
|
|
18
|
+
* URL of the page where the lead was captured (`Landing_Page`).
|
|
19
|
+
* Required for post.
|
|
20
|
+
*/
|
|
21
|
+
landingPage: string;
|
|
22
|
+
/**
|
|
23
|
+
* Posting endpoint for the partner's Boberdoo install. Required so
|
|
24
|
+
* each integration must explicitly opt in to the partner it posts
|
|
25
|
+
* to — no shared-package default. For PCM Growth, use the exported
|
|
26
|
+
* `PCM_GROWTH_LEADPORTAL_ENDPOINT` constant.
|
|
27
|
+
*/
|
|
28
|
+
apiEndpoint: string;
|
|
29
|
+
/**
|
|
30
|
+
* When true the integration sends `Test_Lead=1` and forces `Zip=99999`
|
|
31
|
+
* so the partner routes the lead to their test partner instead of
|
|
32
|
+
* billing a real one.
|
|
17
33
|
*/
|
|
18
34
|
testMode?: boolean;
|
|
19
35
|
}
|
|
20
36
|
/**
|
|
21
|
-
* The lead payload sent to
|
|
37
|
+
* The lead payload sent to the partner. Field names are case-sensitive
|
|
38
|
+
* PascalCase per the LeadPortal/Boberdoo spec.
|
|
22
39
|
*/
|
|
23
40
|
export interface BoberdooLeadPayload {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
Format: "JSON";
|
|
42
|
+
Key: string;
|
|
43
|
+
API_Action: "pingPostLead";
|
|
44
|
+
Mode: "full";
|
|
45
|
+
TYPE: string;
|
|
46
|
+
SRC: string;
|
|
47
|
+
Landing_Page: string;
|
|
48
|
+
Test_Lead?: "1";
|
|
49
|
+
First_Name?: string;
|
|
50
|
+
Last_Name?: string;
|
|
51
|
+
Primary_Phone?: string;
|
|
52
|
+
Email?: string;
|
|
53
|
+
Address?: string;
|
|
54
|
+
City?: string;
|
|
55
|
+
State?: string;
|
|
56
|
+
Zip?: string;
|
|
57
|
+
Trusted_Form_URL?: string;
|
|
58
|
+
LeadiD_Token?: string;
|
|
59
|
+
IP_Address?: string;
|
|
60
|
+
User_Agent?: string;
|
|
61
|
+
Unique_Identifier?: string;
|
|
62
|
+
TCPA_Language?: string;
|
|
63
|
+
Sub_ID?: string;
|
|
64
|
+
Pub_ID?: string;
|
|
65
|
+
utm_source?: string;
|
|
66
|
+
utm_campaign?: string;
|
|
67
|
+
utm_medium?: string;
|
|
68
|
+
utm_content?: string;
|
|
69
|
+
utm_term?: string;
|
|
70
|
+
Comments?: string;
|
|
40
71
|
[key: string]: string | undefined;
|
|
41
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Raw response status returned by the partner. In `Mode=full` the API
|
|
75
|
+
* may return Matched (created + sold), Unmatched (created, no buyer),
|
|
76
|
+
* or Error. The spec PDF claims only Success/Error but the live API
|
|
77
|
+
* returns Matched/Unmatched in practice.
|
|
78
|
+
*/
|
|
79
|
+
export type BoberdooResponseStatus = "Matched" | "Unmatched" | "Error";
|
|
42
80
|
export interface BoberdooResponse {
|
|
43
81
|
status: "Success" | "Failure";
|
|
44
82
|
/**
|
|
45
|
-
* The raw
|
|
83
|
+
* The raw status string from the partner.
|
|
84
|
+
*/
|
|
85
|
+
rawStatus?: BoberdooResponseStatus;
|
|
86
|
+
/**
|
|
87
|
+
* Lead ID returned by the partner on Matched/Unmatched responses.
|
|
88
|
+
*/
|
|
89
|
+
leadId?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Price returned on Matched responses when the partner is on dynamic pricing.
|
|
92
|
+
*/
|
|
93
|
+
price?: string;
|
|
94
|
+
/**
|
|
95
|
+
* The raw response body from the partner.
|
|
46
96
|
*/
|
|
47
97
|
data?: Record<string, unknown>;
|
|
48
98
|
error?: string;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.
|
|
7
|
+
"version": "1.81.0",
|
|
8
8
|
"description": "Service to integrate with Boberdoo lead distribution",
|
|
9
9
|
"types": "lib/index",
|
|
10
10
|
"main": "lib/index",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"@xapp/config": "0.3.0",
|
|
21
21
|
"axios-mock-adapter": "2.1.0",
|
|
22
22
|
"chai": "4.5.0",
|
|
23
|
+
"dotenv": "17.4.2",
|
|
23
24
|
"mocha": "11.7.5",
|
|
24
25
|
"sinon": "21.0.0",
|
|
25
26
|
"stentor-logger": "1.72.3",
|
|
@@ -34,10 +35,11 @@
|
|
|
34
35
|
"scripts": {
|
|
35
36
|
"build": "tsc -d true -p .",
|
|
36
37
|
"clean": "rm -rf ./lib/*",
|
|
37
|
-
"test": "mocha --recursive --timeout 9000 -r ts-node/register \"./src/**/__test__/*.test.ts\""
|
|
38
|
+
"test": "mocha --recursive --timeout 9000 -r ts-node/register \"./src/**/__test__/*.test.ts\"",
|
|
39
|
+
"test:f": "mocha --recursive --timeout 30000 -r ts-node/register \"./src/**/*.ftest.ts\""
|
|
38
40
|
},
|
|
39
41
|
"dependencies": {
|
|
40
42
|
"axios": "1.16.0"
|
|
41
43
|
},
|
|
42
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "34ce220a44ff054cc3818f1900e703c97eb2a579"
|
|
43
45
|
}
|