@memberjunction/actions-apollo 2.1.2 → 2.1.3
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/dist/accounts.d.ts +20 -1
- package/dist/accounts.d.ts.map +1 -1
- package/dist/accounts.js +569 -9
- package/dist/accounts.js.map +1 -1
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +10 -0
- package/dist/config.js.map +1 -0
- package/dist/contacts.d.ts +8 -1
- package/dist/contacts.d.ts.map +1 -1
- package/dist/contacts.js +247 -10
- package/dist/contacts.js.map +1 -1
- package/dist/generic/apollo.types.d.ts +310 -0
- package/dist/generic/apollo.types.d.ts.map +1 -0
- package/dist/generic/apollo.types.js +3 -0
- package/dist/generic/apollo.types.js.map +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/accounts.d.ts
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
import { ActionResultSimple, BaseAction, RunActionParams } from "@memberjunction/actions";
|
|
2
|
-
|
|
2
|
+
import { BaseEntity, Metadata, UserInfo } from "@memberjunction/core";
|
|
3
|
+
import { AxiosResponse } from "axios";
|
|
4
|
+
import { ProcessSingleDomainParams, SearchPeopleResponsePerson, TechnologyMap } from "./generic/apollo.types";
|
|
5
|
+
export declare class ApolloAccountsEnrichmentAction extends BaseAction {
|
|
6
|
+
private ExcludeTitles;
|
|
3
7
|
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
8
|
+
protected ProcessSingleDomain(params: ProcessSingleDomainParams, startRow: number, totalRows: number, md: Metadata, currentUser: UserInfo): Promise<boolean>;
|
|
9
|
+
protected EnrichOrganization(params: ProcessSingleDomainParams, startRow: number, totalRows: number, md: Metadata, currentUser: UserInfo): Promise<boolean>;
|
|
10
|
+
protected CreateAccountTechnologyRecords(params: ProcessSingleDomainParams, accountID: string | number, technologies: TechnologyMap[], md: Metadata, currentUser: UserInfo): Promise<boolean>;
|
|
11
|
+
protected GetOrCreateTechnologyCategoryId(params: ProcessSingleDomainParams, categoryName: string, md: Metadata, currentUser: UserInfo): Promise<number>;
|
|
12
|
+
protected GetOrCreateTechnologyId(name: string, categoryId: number, md: Metadata, currentUser: UserInfo): Promise<number>;
|
|
13
|
+
protected CreateAndEnrichPeople(params: ProcessSingleDomainParams, accountID: string | number, domain: string, startRow: number, md: Metadata, currentUser: UserInfo): Promise<boolean>;
|
|
14
|
+
protected CreateAndEnrichContact(params: ProcessSingleDomainParams, accountID: string | number, person: SearchPeopleResponsePerson, md: Metadata, currentUser: UserInfo, sequence: number, total: number): Promise<boolean>;
|
|
15
|
+
protected GetOrCreateContact(params: ProcessSingleDomainParams, accountID: number | string, person: SearchPeopleResponsePerson, md: Metadata, currentUser: UserInfo): Promise<BaseEntity | null>;
|
|
16
|
+
protected CreateUpdateContactEmploymentAndEducationHistory(params: ProcessSingleDomainParams, contactID: number | string, person: SearchPeopleResponsePerson, md: Metadata, currentUser: UserInfo): Promise<boolean>;
|
|
17
|
+
protected IsValidDate(dateString: string): boolean;
|
|
18
|
+
protected IsExcludedTitle(title: string): boolean;
|
|
19
|
+
protected EscapeSingleQuotes(str: string): string;
|
|
20
|
+
protected WrapApolloCall(method: 'get' | 'post', endpoint: string, data: any, config: any, retryAttempts?: number): Promise<AxiosResponse>;
|
|
21
|
+
private Timeout;
|
|
4
22
|
}
|
|
23
|
+
export declare function LoadApolloAccountsEnrichmentAction(): void;
|
|
5
24
|
//# sourceMappingURL=accounts.d.ts.map
|
package/dist/accounts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"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"}
|
package/dist/accounts.js
CHANGED
|
@@ -1,25 +1,585 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
2
18
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
19
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
20
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
21
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
22
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
23
|
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
+
if (mod && mod.__esModule) return mod;
|
|
26
|
+
var result = {};
|
|
27
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
+
__setModuleDefault(result, mod);
|
|
29
|
+
return result;
|
|
30
|
+
};
|
|
31
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
|
+
};
|
|
8
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
35
|
+
exports.LoadApolloAccountsEnrichmentAction = exports.ApolloAccountsEnrichmentAction = void 0;
|
|
10
36
|
const actions_1 = require("@memberjunction/actions");
|
|
11
37
|
const global_1 = require("@memberjunction/global");
|
|
12
|
-
|
|
38
|
+
const Config = __importStar(require("./config"));
|
|
39
|
+
const core_1 = require("@memberjunction/core");
|
|
40
|
+
const axios_1 = __importDefault(require("axios"));
|
|
41
|
+
// ApolloEnrichContact this Action would use the www.apollo.io enrichment service and enrich a "contact" type of record. The parameters to this Action would be:
|
|
42
|
+
// EntityName - entity in question that contacts "contact" types of records
|
|
43
|
+
// EmailField - string - field name in the target entity that contains the email to be used for lookups
|
|
44
|
+
// FirstNameField - string
|
|
45
|
+
// LastNameField - string
|
|
46
|
+
// AccountNameField - string
|
|
47
|
+
// EnrichmentFieldMapping - JSON - this JSON string would contain mappings for the wide array of enrichment outputs. The idea is that the outputs could include a wide array of things and this would map any of the scalar values that Apollo.io provides back to entity field names in the target entity
|
|
48
|
+
// EducationHistoryEntityName - string - optional - this would contain the name of the entity that will be used to stored the retrieved education history for each contact
|
|
49
|
+
// EmploymentHistoryEntityName - string - optional - would contain the name of the entity that will be used to store the retrieved employment history for each contact
|
|
50
|
+
// ApolloEnrichAccount - same idea and pattern as above, but would be for Account style entities
|
|
51
|
+
// Would appreciate feedback on (a) the approach to how we package this stuff and (b) the approach to params noted above.
|
|
52
|
+
let ApolloAccountsEnrichmentAction = class ApolloAccountsEnrichmentAction extends actions_1.BaseAction {
|
|
53
|
+
constructor() {
|
|
54
|
+
super(...arguments);
|
|
55
|
+
this.ExcludeTitles = ['member', 'student member', 'student', 'volunteer'];
|
|
56
|
+
}
|
|
13
57
|
async InternalRunAction(params) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
58
|
+
if (!Config.ApolloAPIKey) {
|
|
59
|
+
throw new Error('Apollo.io API key not found');
|
|
60
|
+
}
|
|
61
|
+
const accountEntityFieldNamesParam = params.Params.find(p => p.Name === 'AccountEntityFieldNameJSON');
|
|
62
|
+
const accountTechnologyEntityFieldNamesParam = params.Params.find(p => p.Name === 'AccountTechnologyEntityFieldNameJSON');
|
|
63
|
+
const technologyCategoryEntityFieldNamesParam = params.Params.find(p => p.Name === 'TechnologyCategoryEntityFieldNameJSON');
|
|
64
|
+
const ContactEntityFieldNamesParam = params.Params.find(p => p.Name === 'ContactEntityFieldNameJSON');
|
|
65
|
+
const ContactEducationHistoryEntityFieldNamesParam = params.Params.find(p => p.Name === 'ContactEducationHistoryEntityFieldNameJSON');
|
|
66
|
+
let accountEntityFieldNames = null;
|
|
67
|
+
let accountTechnologyEntityFieldNames = null;
|
|
68
|
+
let technologyCategoryEntityFieldNames = null;
|
|
69
|
+
let ContactEntityFieldNames = null;
|
|
70
|
+
let ContactEducationHistoryEntityFieldNames = null;
|
|
71
|
+
if (!accountEntityFieldNamesParam) {
|
|
72
|
+
throw new Error('AccountEntityFieldNames parameter not found');
|
|
73
|
+
}
|
|
74
|
+
if (accountEntityFieldNamesParam && accountEntityFieldNamesParam.Value) {
|
|
75
|
+
accountEntityFieldNames = JSON.parse(accountEntityFieldNamesParam.Value);
|
|
76
|
+
if (accountEntityFieldNames) {
|
|
77
|
+
throw new Error('accountEntityFieldNames is empty');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (accountTechnologyEntityFieldNamesParam && accountTechnologyEntityFieldNamesParam.Value) {
|
|
81
|
+
accountTechnologyEntityFieldNames = JSON.parse(accountTechnologyEntityFieldNamesParam.Value) || null;
|
|
82
|
+
}
|
|
83
|
+
if (technologyCategoryEntityFieldNamesParam && technologyCategoryEntityFieldNamesParam.Value) {
|
|
84
|
+
technologyCategoryEntityFieldNames = JSON.parse(technologyCategoryEntityFieldNamesParam.Value) || null;
|
|
85
|
+
}
|
|
86
|
+
if (ContactEntityFieldNamesParam && ContactEntityFieldNamesParam.Value) {
|
|
87
|
+
ContactEntityFieldNames = JSON.parse(ContactEntityFieldNamesParam.Value) || null;
|
|
88
|
+
}
|
|
89
|
+
if (ContactEducationHistoryEntityFieldNamesParam && ContactEducationHistoryEntityFieldNamesParam.Value) {
|
|
90
|
+
ContactEducationHistoryEntityFieldNames = JSON.parse(ContactEducationHistoryEntityFieldNamesParam.Value) || null;
|
|
91
|
+
}
|
|
92
|
+
const md = new core_1.Metadata();
|
|
93
|
+
const rv = new core_1.RunView();
|
|
94
|
+
const runViewResult = await rv.RunView({
|
|
95
|
+
EntityName: accountEntityFieldNames.EntityName,
|
|
96
|
+
ExtraFilter: accountEntityFieldNames.ExtraFilter,
|
|
97
|
+
}, params.ContextUser);
|
|
98
|
+
if (!runViewResult.Success) {
|
|
99
|
+
return {
|
|
100
|
+
Success: false,
|
|
101
|
+
Message: runViewResult.ErrorMessage,
|
|
102
|
+
ResultCode: "FAILED"
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const results = runViewResult.Results;
|
|
106
|
+
const resultLength = runViewResult.Results.length;
|
|
107
|
+
const tasks = []; // to hold promises
|
|
108
|
+
for (const [index, record] of results.entries()) {
|
|
109
|
+
const processParams = {
|
|
110
|
+
Record: record,
|
|
111
|
+
AccountEntity: accountEntityFieldNames,
|
|
112
|
+
AccountTechnologyEntity: accountTechnologyEntityFieldNames,
|
|
113
|
+
TechnologyCategoryEntity: technologyCategoryEntityFieldNames,
|
|
114
|
+
ContactEntity: ContactEntityFieldNames,
|
|
115
|
+
ContactEducationHistoryEntity: ContactEducationHistoryEntityFieldNames
|
|
116
|
+
};
|
|
117
|
+
const task = this.ProcessSingleDomain(processParams, index, resultLength, md, params.ContextUser);
|
|
118
|
+
tasks.push(task);
|
|
119
|
+
if (tasks.length === Config.ConcurrentGroups || index + 1 >= resultLength) {
|
|
120
|
+
// if we started n tasks or reached the end of the result array, await all started tasks
|
|
121
|
+
await Promise.all(tasks);
|
|
122
|
+
// clear tasks
|
|
123
|
+
tasks.length = 0;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (resultLength > 0) {
|
|
127
|
+
// restart the process once more to see if any records remaining
|
|
128
|
+
(0, core_1.LogStatus)('--- Records left, RESTARTING PROCESS...');
|
|
129
|
+
return await this.InternalRunAction(params);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
(0, core_1.LogStatus)('+++ Completed domain enrichment, no records left to process.');
|
|
133
|
+
return {
|
|
134
|
+
Success: true,
|
|
135
|
+
Message: "ApolloAccountsEnrichment executed successfully.",
|
|
136
|
+
ResultCode: "SUCCESS"
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
async ProcessSingleDomain(params, startRow, totalRows, md, currentUser) {
|
|
141
|
+
const record = params.Record;
|
|
142
|
+
const accountID = record[params.AccountEntity.AccountIDName];
|
|
143
|
+
const domain = record[params.AccountEntity.DomainParamName];
|
|
144
|
+
const enrichOrganizationResult = await this.EnrichOrganization(params, startRow, totalRows, md, currentUser);
|
|
145
|
+
const createAndEnrichPeopleResult = await this.CreateAndEnrichPeople(params, accountID, domain, startRow, md, currentUser);
|
|
146
|
+
return enrichOrganizationResult && createAndEnrichPeopleResult;
|
|
147
|
+
}
|
|
148
|
+
async EnrichOrganization(params, startRow, totalRows, md, currentUser) {
|
|
149
|
+
const record = params.Record;
|
|
150
|
+
const orgQueryString = {
|
|
151
|
+
api_key: Config.ApolloAPIKey,
|
|
152
|
+
domain: record[params.AccountEntity.DomainParamName]
|
|
18
153
|
};
|
|
154
|
+
const headers = {
|
|
155
|
+
'Cache-Control': 'no-cache',
|
|
156
|
+
'Content-Type': 'application/json'
|
|
157
|
+
};
|
|
158
|
+
// get the organization enrichment data first
|
|
159
|
+
const orgResponse = await this.WrapApolloCall('get', 'organizations/enrich', null, { params: orgQueryString, headers: headers });
|
|
160
|
+
if (!orgResponse || orgResponse.status !== 200) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
// here we want to iterate through all the results and update the contacts with the enriched data if
|
|
164
|
+
// the API returned a match
|
|
165
|
+
const result = orgResponse.data;
|
|
166
|
+
let bSuccess = true;
|
|
167
|
+
if (result && result.organization) {
|
|
168
|
+
const organization = result.organization;
|
|
169
|
+
// use the entity object to load up the account and then update some of the fields in it
|
|
170
|
+
const accountEntity = await md.GetEntityObject(params.AccountEntity.EntityName, currentUser);
|
|
171
|
+
accountEntity.SetMany(record);
|
|
172
|
+
if (params.AccountEntity.AddressFieldName) {
|
|
173
|
+
accountEntity.Set(params.AccountEntity.AddressFieldName, organization.street_address);
|
|
174
|
+
}
|
|
175
|
+
if (params.AccountEntity.CityFieldNameName) {
|
|
176
|
+
accountEntity.Set(params.AccountEntity.CityFieldNameName, organization.city);
|
|
177
|
+
}
|
|
178
|
+
if (params.AccountEntity.CityFieldNameName) {
|
|
179
|
+
accountEntity.Set(params.AccountEntity.CityFieldNameName, organization.city);
|
|
180
|
+
}
|
|
181
|
+
if (params.AccountEntity.StateProvinceFieldName) {
|
|
182
|
+
//accountEntity.Set(params.StateProvinceFieldName, organization.state);
|
|
183
|
+
}
|
|
184
|
+
if (params.AccountEntity.PostalCodeFieldName) {
|
|
185
|
+
accountEntity.Set(params.AccountEntity.PostalCodeFieldName, organization.postal_code);
|
|
186
|
+
}
|
|
187
|
+
if (params.AccountEntity.DescriptionFieldName) {
|
|
188
|
+
accountEntity.Set(params.AccountEntity.DescriptionFieldName, organization.short_description);
|
|
189
|
+
}
|
|
190
|
+
if (params.AccountEntity.PhoneNumberFieldName) {
|
|
191
|
+
accountEntity.Set(params.AccountEntity.PhoneNumberFieldName, organization.phone);
|
|
192
|
+
}
|
|
193
|
+
if (params.AccountEntity.CountryFieldName) {
|
|
194
|
+
accountEntity.Set(params.AccountEntity.CountryFieldName, organization.country);
|
|
195
|
+
}
|
|
196
|
+
if (params.AccountEntity.LinkedInFieldName) {
|
|
197
|
+
accountEntity.Set(params.AccountEntity.LinkedInFieldName, organization.linkedin_url);
|
|
198
|
+
}
|
|
199
|
+
if (params.AccountEntity.LogoURLFieldName) {
|
|
200
|
+
accountEntity.Set(params.AccountEntity.LogoURLFieldName, organization.logo_url);
|
|
201
|
+
}
|
|
202
|
+
if (params.AccountEntity.FacebookFieldName) {
|
|
203
|
+
accountEntity.Set(params.AccountEntity.FacebookFieldName, organization.facebook_url);
|
|
204
|
+
}
|
|
205
|
+
if (params.AccountEntity.TwitterFieldName) {
|
|
206
|
+
accountEntity.Set(params.AccountEntity.TwitterFieldName, organization.twitter_url);
|
|
207
|
+
}
|
|
208
|
+
if (params.AccountEntity.EnrichedAtField) {
|
|
209
|
+
accountEntity.Set(params.AccountEntity.EnrichedAtField, new Date());
|
|
210
|
+
}
|
|
211
|
+
// no field for twitter, add this mapping when that's done
|
|
212
|
+
//accountEntity.Twitter = result.organization.twitter_url;
|
|
213
|
+
const saveResult = await accountEntity.Save();
|
|
214
|
+
if (!saveResult) {
|
|
215
|
+
(0, core_1.LogError)('Error updating account record with enriched data', undefined, accountEntity.LatestResult);
|
|
216
|
+
}
|
|
217
|
+
if (params.AccountTechnologyEntity) {
|
|
218
|
+
// now, attempt to create technology records for linking to the account
|
|
219
|
+
const accountID = record[params.AccountEntity.AccountIDName];
|
|
220
|
+
bSuccess = bSuccess && await this.CreateAccountTechnologyRecords(params, accountID, result.organization.current_technologies, md, currentUser);
|
|
221
|
+
}
|
|
222
|
+
return bSuccess;
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
// missing records == details.length means no matches were found
|
|
226
|
+
(0, core_1.LogStatus)(` > No matches found for this domain: ${params.Record[params.AccountEntity.DomainParamName]}`);
|
|
227
|
+
// even though there was no match, we still update the LastEnrichedAt field on the account otherwise we'll keep on attempting to run this each
|
|
228
|
+
// time this process goes through the list of accounts.
|
|
229
|
+
const accountEntity = await md.GetEntityObject('Accounts', currentUser);
|
|
230
|
+
accountEntity.SetMany(params.Record);
|
|
231
|
+
accountEntity.Set(params.AccountEntity.EnrichedAtField, new Date());
|
|
232
|
+
const saveResult = await accountEntity.Save();
|
|
233
|
+
if (!saveResult) {
|
|
234
|
+
(0, core_1.LogError)('Error updating account record with enriched data', undefined, accountEntity.LatestResult);
|
|
235
|
+
}
|
|
236
|
+
return saveResult;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
async CreateAccountTechnologyRecords(params, accountID, technologies, md, currentUser) {
|
|
240
|
+
let bSuccess = true;
|
|
241
|
+
const ATEntity = params.AccountTechnologyEntity;
|
|
242
|
+
if (!ATEntity) {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
const rv = new core_1.RunView();
|
|
246
|
+
const runViewResult = await rv.RunView({
|
|
247
|
+
EntityName: `${ATEntity.EntityName}`,
|
|
248
|
+
ExtraFilter: `${ATEntity.AccountIDFieldName} = ${accountID}`
|
|
249
|
+
}, currentUser);
|
|
250
|
+
if (!runViewResult.Success) {
|
|
251
|
+
(0, core_1.LogError)('Error querying for existing Account Technologies', undefined, runViewResult.ErrorMessage);
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
for (const technology of technologies) {
|
|
255
|
+
const categoryId = await this.GetOrCreateTechnologyCategoryId(params, technology.category, md, currentUser);
|
|
256
|
+
const row = runViewResult.Results.find((r) => r.Category.trim().toLowerCase() === technology.category.trim().toLowerCase() && r.Technology.trim().toLowerCase() === technology.name.trim().toLowerCase());
|
|
257
|
+
if (!row || row.length === 0) {
|
|
258
|
+
const at = await md.GetEntityObject(ATEntity.EntityName, currentUser);
|
|
259
|
+
at.Set(ATEntity.AccountIDFieldName, accountID);
|
|
260
|
+
at.Set(ATEntity.TechnologyIDFieldName, await this.GetOrCreateTechnologyId(technology.name, categoryId, md, currentUser));
|
|
261
|
+
bSuccess = bSuccess && await at.Save();
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
row.matchFound = true;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
// finally, go through all the rows in existingRows, and for any that have matchFound === true, skip
|
|
268
|
+
// but for rest update them to have their EndedAt = NOW
|
|
269
|
+
const fieldName = ATEntity.MatchFoundFieldName;
|
|
270
|
+
for (const record of runViewResult.Results) {
|
|
271
|
+
if (!record[fieldName]) {
|
|
272
|
+
const entity = await md.GetEntityObject(fieldName, currentUser);
|
|
273
|
+
entity.SetMany(record);
|
|
274
|
+
entity.Set(ATEntity.EndedUseAtFieldName, new Date());
|
|
275
|
+
const saveResult = await entity.Save();
|
|
276
|
+
if (!saveResult) {
|
|
277
|
+
(0, core_1.LogError)('Error updating Account Technology record with enriched data', undefined, entity.LatestResult);
|
|
278
|
+
}
|
|
279
|
+
bSuccess = bSuccess && saveResult;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return bSuccess;
|
|
283
|
+
}
|
|
284
|
+
async GetOrCreateTechnologyCategoryId(params, categoryName, md, currentUser) {
|
|
285
|
+
const TCEntity = params.TechnologyCategoryEntity;
|
|
286
|
+
if (!TCEntity) {
|
|
287
|
+
return 0;
|
|
288
|
+
}
|
|
289
|
+
const rv = new core_1.RunView();
|
|
290
|
+
const runViewResult = await rv.RunView({
|
|
291
|
+
EntityName: TCEntity.EntityName,
|
|
292
|
+
ExtraFilter: `${TCEntity.NameFieldName} = '${this.EscapeSingleQuotes(categoryName)}'`
|
|
293
|
+
}, currentUser);
|
|
294
|
+
if (!runViewResult.Success) {
|
|
295
|
+
(0, core_1.LogError)('Error querying for existing Technology Categories', undefined, runViewResult.ErrorMessage);
|
|
296
|
+
return 0;
|
|
297
|
+
}
|
|
298
|
+
if (runViewResult.Results.length > 0) {
|
|
299
|
+
return runViewResult.Results[0].ID;
|
|
300
|
+
}
|
|
301
|
+
//create a new record
|
|
302
|
+
const entity = await md.GetEntityObject(TCEntity.EntityName, currentUser);
|
|
303
|
+
entity.Set(TCEntity.NameFieldName, categoryName);
|
|
304
|
+
const saveResult = await entity.Save();
|
|
305
|
+
if (!saveResult) {
|
|
306
|
+
(0, core_1.LogError)('Error creating new Technology Category record', undefined, entity.LatestResult);
|
|
307
|
+
return 0;
|
|
308
|
+
}
|
|
309
|
+
return entity.Get(TCEntity.IDFieldName);
|
|
310
|
+
}
|
|
311
|
+
async GetOrCreateTechnologyId(name, categoryId, md, currentUser) {
|
|
312
|
+
const rv = new core_1.RunView();
|
|
313
|
+
const runViewResult = await rv.RunView({
|
|
314
|
+
EntityName: 'Technologies',
|
|
315
|
+
ExtraFilter: `Name = '${this.EscapeSingleQuotes(name)}' AND CategoryID = ${categoryId}`
|
|
316
|
+
}, currentUser);
|
|
317
|
+
if (!runViewResult.Success) {
|
|
318
|
+
(0, core_1.LogError)('Error querying for existing Technologies', undefined, runViewResult.ErrorMessage);
|
|
319
|
+
return 0;
|
|
320
|
+
}
|
|
321
|
+
if (runViewResult.Results.length > 0) {
|
|
322
|
+
return runViewResult.Results[0].ID;
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
const technologyEntity = await md.GetEntityObject('Technologies', currentUser);
|
|
326
|
+
technologyEntity.Set('Name', name);
|
|
327
|
+
technologyEntity.Set('CategoryID', categoryId);
|
|
328
|
+
const saveResult = await technologyEntity.Save();
|
|
329
|
+
if (!saveResult) {
|
|
330
|
+
(0, core_1.LogError)('Error creating new Technology record', undefined, technologyEntity.LatestResult);
|
|
331
|
+
return 0;
|
|
332
|
+
}
|
|
333
|
+
return technologyEntity.Get('ID');
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
async CreateAndEnrichPeople(params, accountID, domain, startRow, md, currentUser) {
|
|
337
|
+
let APIparams = {
|
|
338
|
+
api_key: Config.ApolloAPIKey,
|
|
339
|
+
reveal_personal_emails: true,
|
|
340
|
+
q_organization_domains: domain,
|
|
341
|
+
page: 1
|
|
342
|
+
};
|
|
343
|
+
const headers = {
|
|
344
|
+
'Cache-Control': 'no-cache',
|
|
345
|
+
'Content-Type': 'application/json'
|
|
346
|
+
};
|
|
347
|
+
const response = await this.WrapApolloCall('post', 'mixed_people/search', APIparams, { headers: headers });
|
|
348
|
+
if (!response || response.status !== 200) {
|
|
349
|
+
(0, core_1.LogError)(`Error fetching data from Apollo.io: ${response.statusText}`);
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
// here we want to iterate through all the results and update the contacts with the enriched data if
|
|
353
|
+
// the API returned a match
|
|
354
|
+
const data = response.data;
|
|
355
|
+
const allPeople = data.people;
|
|
356
|
+
for (let i = 1; i < data.pagination.total_pages && i < (Config.MaxPeopleToEnrichPerOrg / 10); i++) {
|
|
357
|
+
//get additional pages
|
|
358
|
+
APIparams.page = i + 1;
|
|
359
|
+
const nextResponse = await this.WrapApolloCall('post', 'mixed_people/search', params, { headers: headers });
|
|
360
|
+
if (nextResponse.status !== 200) {
|
|
361
|
+
console.error(`Error fetching data from Apollo.io: ${nextResponse.statusText}`);
|
|
362
|
+
return false;
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
// here we want to iterate through all the results and update the contacts with the enriched data if
|
|
366
|
+
// the API returned a match
|
|
367
|
+
const nextResult = nextResponse.data;
|
|
368
|
+
allPeople.push(...nextResult.people);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
let bSuccess = true;
|
|
372
|
+
if (allPeople.length === 0) {
|
|
373
|
+
(0, core_1.LogStatus)(`No people found for this domain: ${domain}`);
|
|
374
|
+
return true;
|
|
375
|
+
}
|
|
376
|
+
let i = 0;
|
|
377
|
+
for (const person of allPeople) {
|
|
378
|
+
// first, check to make sure that the person has an email and the domain matches the
|
|
379
|
+
// account domain, we don't want people who's primary email doesn't match the domain
|
|
380
|
+
if (!person.last_name || !person.email || person.email.split('@')[1] !== domain) {
|
|
381
|
+
// skip this person
|
|
382
|
+
(0, core_1.LogStatus)(`Skipping person: ${person.first_name} ${person.last_name}, accountID: ${accountID} because email is missing or does not match domain`);
|
|
383
|
+
}
|
|
384
|
+
else if (this.IsExcludedTitle(person.title)) {
|
|
385
|
+
(0, core_1.LogStatus)(`Skipping person: ${person.first_name} ${person.last_name}, accountID: ${accountID} because title is excluded`);
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
bSuccess = bSuccess && await this.CreateAndEnrichContact(params, accountID, person, md, currentUser, i, allPeople.length);
|
|
389
|
+
}
|
|
390
|
+
i++;
|
|
391
|
+
}
|
|
392
|
+
return bSuccess;
|
|
393
|
+
}
|
|
394
|
+
async CreateAndEnrichContact(params, accountID, person, md, currentUser, sequence, total) {
|
|
395
|
+
const CEntity = params.ContactEntity;
|
|
396
|
+
if (!CEntity) {
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
try {
|
|
400
|
+
(0, core_1.LogStatus)(`Enriching contact for person: ${person.first_name} ${person.last_name}, accountID: ${accountID} (${sequence} of ${total})`);
|
|
401
|
+
// first check to see if there is an existing contact record for this person
|
|
402
|
+
const contact = await this.GetOrCreateContact(params, accountID, person, md, currentUser);
|
|
403
|
+
if (!contact) {
|
|
404
|
+
return false;
|
|
405
|
+
}
|
|
406
|
+
// now we have a contact entity object and we can enrich it.
|
|
407
|
+
contact.Set(CEntity.FirstNameFieldName, person.first_name);
|
|
408
|
+
contact.Set(CEntity.LastNameFieldName, person.last_name);
|
|
409
|
+
contact.Set(CEntity.TitleFieldName, person.title);
|
|
410
|
+
if (person.email) {
|
|
411
|
+
contact.Set(CEntity.EmailFieldName, person.email);
|
|
412
|
+
}
|
|
413
|
+
contact.Set(CEntity.FacebookFieldName, person.facebook_url);
|
|
414
|
+
contact.Set(CEntity.LinkedInFieldName, person.linkedin_url);
|
|
415
|
+
contact.Set(CEntity.TwitterFieldName, person.twitter_url);
|
|
416
|
+
//contact.Set("PhoneNumber", person.?.length > 0 ? person.phone_numbers[0].raw_number : null;
|
|
417
|
+
contact.Set(CEntity.PhotoFieldName, person.photo_url);
|
|
418
|
+
contact.Set(CEntity.LastEnrichedAtFieldName, new Date());
|
|
419
|
+
const saveResult = contact.Save();
|
|
420
|
+
if (!saveResult) {
|
|
421
|
+
(0, core_1.LogError)('Error updating contact record with enriched data', undefined, contact.LatestResult);
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
424
|
+
return await contact.Save() && await this.CreateUpdateContactEmploymentAndEducationHistory(params, contact.Get("ID"), person, md, currentUser);
|
|
425
|
+
}
|
|
426
|
+
catch (e) {
|
|
427
|
+
(0, core_1.LogError)(e);
|
|
428
|
+
return false;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
async GetOrCreateContact(params, accountID, person, md, currentUser) {
|
|
432
|
+
const CEntity = params.ContactEntity;
|
|
433
|
+
if (!CEntity) {
|
|
434
|
+
return null;
|
|
435
|
+
}
|
|
436
|
+
const rv = new core_1.RunView();
|
|
437
|
+
const runViewResult = await rv.RunView({
|
|
438
|
+
EntityName: CEntity.EntityName,
|
|
439
|
+
ExtraFilter: `${CEntity.EmailFieldName} = '${this.EscapeSingleQuotes(person.email)}' AND ${CEntity.AccountIDFieldName} <> ${accountID}`
|
|
440
|
+
}, currentUser);
|
|
441
|
+
if (!runViewResult.Success) {
|
|
442
|
+
(0, core_1.LogError)('Error querying for existing Contacts', undefined, runViewResult.ErrorMessage);
|
|
443
|
+
return null;
|
|
444
|
+
}
|
|
445
|
+
if (runViewResult.Results.length > 0) {
|
|
446
|
+
const results = runViewResult.Results;
|
|
447
|
+
(0, core_1.LogError)(`*** SKIPPING new contact record for ${person.first_name} ${person.last_name} because they are already associated with AccountID: ${results[0].AccountID} - ContactID: ${results[0].ID}`);
|
|
448
|
+
return null;
|
|
449
|
+
}
|
|
450
|
+
// ok, now that we know this person is not associated with another account, check to see if there is an existing record in the vwContacts view FOR this account, could do this more efficiently with a single SQL
|
|
451
|
+
// query, but this is easier to read and understand
|
|
452
|
+
const contactsViewResult = await rv.RunView({
|
|
453
|
+
EntityName: CEntity.EntityName,
|
|
454
|
+
ExtraFilter: `(${CEntity.EmailFieldName} = '${this.EscapeSingleQuotes(person.email)}' OR (${CEntity.FirstNameFieldName} = '${this.EscapeSingleQuotes(person.first_name)}' AND ${CEntity.LastNameFieldName} = '${this.EscapeSingleQuotes(person.last_name)}')) AND
|
|
455
|
+
${CEntity.AccountIDFieldName} = ${accountID}`
|
|
456
|
+
}, currentUser);
|
|
457
|
+
if (!contactsViewResult.Success) {
|
|
458
|
+
(0, core_1.LogError)('Error querying for existing Contacts', undefined, contactsViewResult.ErrorMessage);
|
|
459
|
+
return null;
|
|
460
|
+
}
|
|
461
|
+
const contactEntity = await md.GetEntityObject(CEntity.EntityName, currentUser);
|
|
462
|
+
if (contactsViewResult.Results.length > 0) {
|
|
463
|
+
contactEntity.SetMany(contactsViewResult.Results[0]);
|
|
464
|
+
contactEntity.Set(CEntity.EmailFieldName, person.email);
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
(0, core_1.LogStatus)(` > Creating new contact record for ${person.first_name} ${person.last_name}`);
|
|
468
|
+
contactEntity.NewRecord();
|
|
469
|
+
contactEntity.Set(CEntity.EmailFieldName, person.email);
|
|
470
|
+
contactEntity.Set(CEntity.AccountIDFieldName, accountID);
|
|
471
|
+
contactEntity.Set(CEntity.ActivityCountFieldName, 0);
|
|
472
|
+
contactEntity.Set(CEntity.EmailSourceFieldName, Config.EmailSourceName);
|
|
473
|
+
}
|
|
474
|
+
return contactEntity;
|
|
475
|
+
}
|
|
476
|
+
async CreateUpdateContactEmploymentAndEducationHistory(params, contactID, person, md, currentUser) {
|
|
477
|
+
const CEntity = params.ContactEducationHistoryEntity;
|
|
478
|
+
if (!CEntity) {
|
|
479
|
+
return false;
|
|
480
|
+
}
|
|
481
|
+
let bSuccess = true;
|
|
482
|
+
const rv = new core_1.RunView();
|
|
483
|
+
for (const history of person.employment_history) {
|
|
484
|
+
if (history.degree && history.degree.length > 0) {
|
|
485
|
+
const EHRunViewResult = await rv.RunView({
|
|
486
|
+
EntityName: CEntity.EntityName,
|
|
487
|
+
ExtraFilter: `${CEntity.ContactIDFieldName} = ${contactID} AND ${CEntity.InstitutionFieldName} = '${this.EscapeSingleQuotes(history.organization_name)}' AND ${CEntity.DegreeFieldName} = '${this.EscapeSingleQuotes(history.degree)}'`
|
|
488
|
+
}, currentUser);
|
|
489
|
+
if (!EHRunViewResult.Success) {
|
|
490
|
+
(0, core_1.LogError)('Error querying for existing Employment History', undefined, EHRunViewResult.ErrorMessage);
|
|
491
|
+
bSuccess = false;
|
|
492
|
+
}
|
|
493
|
+
const historyEntity = await md.GetEntityObject(CEntity.EntityName, currentUser);
|
|
494
|
+
if (EHRunViewResult.Results.length > 0) {
|
|
495
|
+
historyEntity.SetMany(EHRunViewResult.Results[0]);
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
historyEntity.NewRecord();
|
|
499
|
+
historyEntity.Set(CEntity.ContactIDFieldName, contactID);
|
|
500
|
+
}
|
|
501
|
+
historyEntity.Set(CEntity.InstitutionFieldName, history.organization_name);
|
|
502
|
+
historyEntity.Set(CEntity.DegreeFieldName, history.degree);
|
|
503
|
+
historyEntity.Set(CEntity.GradeLevelFieldName, !isNaN(history.grade_level) ? parseInt(history.grade_level) : 0);
|
|
504
|
+
if (this.IsValidDate(history.start_date)) {
|
|
505
|
+
historyEntity.Set(CEntity.StartDateFieldName, new Date(history.start_date));
|
|
506
|
+
}
|
|
507
|
+
if (this.IsValidDate(history.end_date)) {
|
|
508
|
+
historyEntity.Set(CEntity.EndDateFieldName, new Date(history.end_date));
|
|
509
|
+
}
|
|
510
|
+
historyEntity.Set(CEntity.IsCurrentFieldName, history.current);
|
|
511
|
+
const saveResult = await historyEntity.Save();
|
|
512
|
+
if (!saveResult) {
|
|
513
|
+
(0, core_1.LogError)('Error saving Employment History record', undefined, historyEntity.LatestResult);
|
|
514
|
+
bSuccess = false;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
return bSuccess;
|
|
519
|
+
}
|
|
520
|
+
IsValidDate(dateString) {
|
|
521
|
+
if (dateString && dateString.length > 0) {
|
|
522
|
+
const date = new Date(dateString);
|
|
523
|
+
return date instanceof Date && !isNaN(date.getTime());
|
|
524
|
+
}
|
|
525
|
+
else {
|
|
526
|
+
return false;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
IsExcludedTitle(title) {
|
|
530
|
+
if (!title) {
|
|
531
|
+
return false;
|
|
532
|
+
}
|
|
533
|
+
return this.ExcludeTitles.includes(title.toLowerCase());
|
|
534
|
+
}
|
|
535
|
+
EscapeSingleQuotes(str) {
|
|
536
|
+
if (str) {
|
|
537
|
+
return str.replace(/'/g, "''");
|
|
538
|
+
}
|
|
539
|
+
return '';
|
|
540
|
+
}
|
|
541
|
+
async WrapApolloCall(method, endpoint, data, config, retryAttempts = 1) {
|
|
542
|
+
try {
|
|
543
|
+
const url = `${Config.ApolloAPIEndpoint}/${endpoint}`;
|
|
544
|
+
let response = method === 'get' ? await axios_1.default.get(url, config) : await axios_1.default.post(url, data, config);
|
|
545
|
+
if (response.status === 429) {
|
|
546
|
+
if (retryAttempts > 0) {
|
|
547
|
+
(0, core_1.LogStatus)(' >>> Too many requests to Apollo.io API, waiting 1 minute and trying again...');
|
|
548
|
+
await this.Timeout(60000); // wait 1 minute
|
|
549
|
+
return await this.WrapApolloCall(method, endpoint, data, config, retryAttempts - 1);
|
|
550
|
+
}
|
|
551
|
+
else {
|
|
552
|
+
throw { message: 'Too many requests to Apollo.io API', code: 429 };
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
return response;
|
|
556
|
+
}
|
|
557
|
+
catch (apolloError) {
|
|
558
|
+
// axios could throw an exception for a 429 instead of a response, so we need to handle that here
|
|
559
|
+
if (apolloError && apolloError.response && apolloError.response.status === 429) {
|
|
560
|
+
if (retryAttempts > 0) {
|
|
561
|
+
(0, core_1.LogStatus)(' >>> Too many requests to Apollo.io API, waiting 1 minute and trying again...');
|
|
562
|
+
await this.Timeout(60000); // wait 1 minute
|
|
563
|
+
return await this.WrapApolloCall(method, endpoint, data, config, retryAttempts - 1);
|
|
564
|
+
}
|
|
565
|
+
else {
|
|
566
|
+
throw { message: 'Too many requests to Apollo.io API', code: 429 };
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
else {
|
|
570
|
+
throw apolloError;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
async Timeout(ms) {
|
|
575
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
19
576
|
}
|
|
20
577
|
};
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
578
|
+
exports.ApolloAccountsEnrichmentAction = ApolloAccountsEnrichmentAction;
|
|
579
|
+
exports.ApolloAccountsEnrichmentAction = ApolloAccountsEnrichmentAction = __decorate([
|
|
23
580
|
(0, global_1.RegisterClass)(actions_1.BaseAction, "Apollo Enrichment - Accounts")
|
|
24
|
-
],
|
|
581
|
+
], ApolloAccountsEnrichmentAction);
|
|
582
|
+
function LoadApolloAccountsEnrichmentAction() {
|
|
583
|
+
}
|
|
584
|
+
exports.LoadApolloAccountsEnrichmentAction = LoadApolloAccountsEnrichmentAction;
|
|
25
585
|
//# sourceMappingURL=accounts.js.map
|