@builderbot/provider-gohighlevel 1.3.15-alpha.11
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 +463 -0
- package/dist/gohighlevel/core.d.ts +20 -0
- package/dist/gohighlevel/core.d.ts.map +1 -0
- package/dist/gohighlevel/provider.d.ts +115 -0
- package/dist/gohighlevel/provider.d.ts.map +1 -0
- package/dist/index.cjs +13056 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/interface/gohighlevel.d.ts +12 -0
- package/dist/interface/gohighlevel.d.ts.map +1 -0
- package/dist/types.d.ts +122 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/channelLister.d.ts +24 -0
- package/dist/utils/channelLister.d.ts.map +1 -0
- package/dist/utils/contactResolver.d.ts +10 -0
- package/dist/utils/contactResolver.d.ts.map +1 -0
- package/dist/utils/downloadFile.d.ts +11 -0
- package/dist/utils/downloadFile.d.ts.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/number.d.ts +2 -0
- package/dist/utils/number.d.ts.map +1 -0
- package/dist/utils/processIncomingMsg.d.ts +3 -0
- package/dist/utils/processIncomingMsg.d.ts.map +1 -0
- package/dist/utils/tokenManager.d.ts +36 -0
- package/dist/utils/tokenManager.d.ts.map +1 -0
- package/dist/utils/webhookVerification.d.ts +20 -0
- package/dist/utils/webhookVerification.d.ts.map +1 -0
- package/package.json +57 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { GoHighLevelProvider } from './gohighlevel/provider';
|
|
2
|
+
export { GoHighLevelCoreVendor } from './gohighlevel/core';
|
|
3
|
+
export { TokenManager } from './utils/tokenManager';
|
|
4
|
+
export { ContactResolver } from './utils/contactResolver';
|
|
5
|
+
export { verifyWebhookSignature, extractSignatureFromHeaders } from './utils/webhookVerification';
|
|
6
|
+
export * from './utils/processIncomingMsg';
|
|
7
|
+
export * from './types';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AACjG,cAAc,4BAA4B,CAAA;AAC1C,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SendOptions, BotContext, Button } from '@builderbot/bot/dist/types';
|
|
2
|
+
import type { GHLMessage, GHLSendMessageBody, SaveFileOptions } from '~/types';
|
|
3
|
+
export interface GoHighLevelInterface {
|
|
4
|
+
sendText: (to: string, message: string) => Promise<any>;
|
|
5
|
+
sendMedia: (to: string, text: string, mediaInput: string) => Promise<any>;
|
|
6
|
+
sendButtons: (to: string, buttons: Button[], text: string) => Promise<any>;
|
|
7
|
+
sendMessage: (to: string, message: string, options?: SendOptions) => Promise<any>;
|
|
8
|
+
sendMessageToApi: (body: GHLSendMessageBody) => Promise<any>;
|
|
9
|
+
saveFile: (ctx: Partial<GHLMessage & BotContext>, options?: SaveFileOptions) => Promise<string>;
|
|
10
|
+
resolveContactId: (phone: string) => Promise<string | null>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=gohighlevel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gohighlevel.d.ts","sourceRoot":"","sources":["../../src/interface/gohighlevel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAEjF,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9E,MAAM,WAAW,oBAAoB;IACjC,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IACvD,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IACzE,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IAC1E,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IACjF,gBAAgB,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IAC5D,QAAQ,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC,EAAE,OAAO,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IAC/F,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;CAC9D"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { GlobalVendorArgs } from '@builderbot/bot/dist/types';
|
|
2
|
+
export type GHLChannelType = 'SMS' | 'WhatsApp' | 'Email' | 'Live_Chat' | 'Facebook' | 'Instagram' | 'Custom';
|
|
3
|
+
export interface GHLGlobalVendorArgs extends GlobalVendorArgs {
|
|
4
|
+
clientId: string;
|
|
5
|
+
clientSecret: string;
|
|
6
|
+
locationId: string;
|
|
7
|
+
channelType: GHLChannelType;
|
|
8
|
+
apiVersion: string;
|
|
9
|
+
redirectUri?: string;
|
|
10
|
+
accessToken?: string;
|
|
11
|
+
refreshToken?: string;
|
|
12
|
+
conversationProviderId?: string;
|
|
13
|
+
/** Optional webhook secret for signature verification (HMAC SHA256) */
|
|
14
|
+
webhookSecret?: string;
|
|
15
|
+
/** Optional version ID for OAuth authorization URL */
|
|
16
|
+
versionId?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface GHLOAuthTokens {
|
|
19
|
+
access_token: string;
|
|
20
|
+
refresh_token: string;
|
|
21
|
+
token_type: string;
|
|
22
|
+
expires_in: number;
|
|
23
|
+
scope: string;
|
|
24
|
+
locationId: string;
|
|
25
|
+
userId?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface GHLContact {
|
|
28
|
+
id: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
firstName?: string;
|
|
31
|
+
lastName?: string;
|
|
32
|
+
email?: string;
|
|
33
|
+
phone?: string;
|
|
34
|
+
locationId?: string;
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
}
|
|
37
|
+
export interface GHLConversation {
|
|
38
|
+
id: string;
|
|
39
|
+
contactId: string;
|
|
40
|
+
locationId: string;
|
|
41
|
+
type?: string;
|
|
42
|
+
[key: string]: any;
|
|
43
|
+
}
|
|
44
|
+
export interface GHLMessage {
|
|
45
|
+
type: string;
|
|
46
|
+
from: string;
|
|
47
|
+
to: string;
|
|
48
|
+
body: string;
|
|
49
|
+
name: string;
|
|
50
|
+
pushName: string;
|
|
51
|
+
message_id?: string;
|
|
52
|
+
timestamp?: any;
|
|
53
|
+
url?: string;
|
|
54
|
+
attachments?: GHLAttachment[];
|
|
55
|
+
contactId?: string;
|
|
56
|
+
conversationId?: string;
|
|
57
|
+
channelType?: GHLChannelType;
|
|
58
|
+
direction?: 'inbound' | 'outbound';
|
|
59
|
+
}
|
|
60
|
+
export interface GHLAttachment {
|
|
61
|
+
url: string;
|
|
62
|
+
type?: string;
|
|
63
|
+
name?: string;
|
|
64
|
+
size?: number;
|
|
65
|
+
}
|
|
66
|
+
export interface GHLSendMessageBody {
|
|
67
|
+
type: GHLChannelType;
|
|
68
|
+
contactId: string;
|
|
69
|
+
message?: string;
|
|
70
|
+
html?: string;
|
|
71
|
+
subject?: string;
|
|
72
|
+
attachments?: string[];
|
|
73
|
+
conversationProviderId?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface GHLIncomingWebhook {
|
|
76
|
+
type: string;
|
|
77
|
+
locationId: string;
|
|
78
|
+
contactId?: string;
|
|
79
|
+
conversationId?: string;
|
|
80
|
+
messageId?: string;
|
|
81
|
+
body?: string;
|
|
82
|
+
messageType?: string;
|
|
83
|
+
phone?: string;
|
|
84
|
+
email?: string;
|
|
85
|
+
direction?: 'inbound' | 'outbound';
|
|
86
|
+
status?: string;
|
|
87
|
+
attachments?: GHLAttachment[];
|
|
88
|
+
dateAdded?: string;
|
|
89
|
+
[key: string]: any;
|
|
90
|
+
}
|
|
91
|
+
export interface GHLContactSearchResult {
|
|
92
|
+
contacts: GHLContact[];
|
|
93
|
+
meta?: {
|
|
94
|
+
total: number;
|
|
95
|
+
currentPage: number;
|
|
96
|
+
nextPage: number | null;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export interface SaveFileOptions {
|
|
100
|
+
path?: string;
|
|
101
|
+
}
|
|
102
|
+
export interface GHLPhoneNumber {
|
|
103
|
+
id: string;
|
|
104
|
+
number: string;
|
|
105
|
+
name?: string;
|
|
106
|
+
locationId?: string;
|
|
107
|
+
capabilities?: string[];
|
|
108
|
+
status?: string;
|
|
109
|
+
}
|
|
110
|
+
export interface GHLEmailAccount {
|
|
111
|
+
id: string;
|
|
112
|
+
email: string;
|
|
113
|
+
name?: string;
|
|
114
|
+
locationId?: string;
|
|
115
|
+
}
|
|
116
|
+
export interface GHLChannelInfo {
|
|
117
|
+
type: 'phone' | 'email';
|
|
118
|
+
id: string;
|
|
119
|
+
value: string;
|
|
120
|
+
name?: string;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAElE,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,UAAU,GAAG,OAAO,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,CAAA;AAE7G,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IACzD,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,cAAc,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,cAAc;IAC3B,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,UAAU;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,C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AI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,OAAO,GAAG,OAAO,CAAA;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import EventEmitter from 'node:events';
|
|
2
|
+
import type { GHLChannelInfo, GHLChannelType, GHLEmailAccount, GHLPhoneNumber } from '~/types';
|
|
3
|
+
/**
|
|
4
|
+
* Lists available channels (phone numbers, emails) from GoHighLevel
|
|
5
|
+
* @emits error - When API calls fail (non-permission errors only)
|
|
6
|
+
*/
|
|
7
|
+
export declare class ChannelLister extends EventEmitter {
|
|
8
|
+
private apiVersion;
|
|
9
|
+
constructor(apiVersion?: string);
|
|
10
|
+
/**
|
|
11
|
+
* List active phone numbers for a location
|
|
12
|
+
*/
|
|
13
|
+
listPhoneNumbers(locationId: string, token: string): Promise<GHLPhoneNumber[]>;
|
|
14
|
+
/**
|
|
15
|
+
* List email accounts/addresses for a location
|
|
16
|
+
* Note: GHL may not have a direct endpoint for this, trying conversation providers
|
|
17
|
+
*/
|
|
18
|
+
listEmails(locationId: string, token: string): Promise<GHLEmailAccount[]>;
|
|
19
|
+
/**
|
|
20
|
+
* List channels based on channel type
|
|
21
|
+
*/
|
|
22
|
+
listByChannelType(channelType: GHLChannelType, locationId: string, token: string): Promise<GHLChannelInfo[]>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=channelLister.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channelLister.d.ts","sourceRoot":"","sources":["../../src/utils/channelLister.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,aAAa,CAAA;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI9F;;;GAGG;AACH,qBAAa,aAAc,SAAQ,YAAY;IAC3C,OAAO,CAAC,UAAU,CAAQ;gBAEd,UAAU,GAAE,MAAqB;IAK7C;;OAEG;IACG,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAqCpF;;;OAGG;IACG,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAkD/E;;OAEG;IACG,iBAAiB,CAAC,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;CA2BrH"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import EventEmitter from 'node:events';
|
|
2
|
+
export declare class ContactResolver extends EventEmitter {
|
|
3
|
+
private cache;
|
|
4
|
+
private cacheTTL;
|
|
5
|
+
private apiVersion;
|
|
6
|
+
constructor(apiVersion?: string, cacheTTL?: number);
|
|
7
|
+
resolveContactId(phone: string, locationId: string, token: string): Promise<string | null>;
|
|
8
|
+
clearCache(): void;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=contactResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contactResolver.d.ts","sourceRoot":"","sources":["../../src/utils/contactResolver.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,aAAa,CAAA;AAQtC,qBAAa,eAAgB,SAAQ,YAAY;IAC7C,OAAO,CAAC,KAAK,CAAmE;IAChF,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,UAAU,CAAQ;gBAEd,UAAU,GAAE,MAAqB,EAAE,QAAQ,CAAC,EAAE,MAAM;IAM1D,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IA4ChG,UAAU,IAAI,IAAI;CAGrB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AxiosResponse } from 'axios';
|
|
2
|
+
declare const fileTypeFromResponse: (response: AxiosResponse) => {
|
|
3
|
+
type: string | null;
|
|
4
|
+
ext: string | false;
|
|
5
|
+
};
|
|
6
|
+
declare function downloadFile(url: string, token: string): Promise<{
|
|
7
|
+
buffer: Buffer;
|
|
8
|
+
extension: string;
|
|
9
|
+
}>;
|
|
10
|
+
export { downloadFile, fileTypeFromResponse };
|
|
11
|
+
//# sourceMappingURL=downloadFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"downloadFile.d.ts","sourceRoot":"","sources":["../../src/utils/downloadFile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAG1C,QAAA,MAAM,oBAAoB,GAAI,UAAU,aAAa,KAAG;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAA;CAIjG,CAAA;AAED,iBAAe,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CActG;AAED,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { downloadFile, fileTypeFromResponse } from './downloadFile';
|
|
2
|
+
export { processIncomingMessage } from './processIncomingMsg';
|
|
3
|
+
export { parseGHLNumber } from './number';
|
|
4
|
+
export { TokenManager } from './tokenManager';
|
|
5
|
+
export { ContactResolver } from './contactResolver';
|
|
6
|
+
export { verifyWebhookSignature, extractSignatureFromHeaders } from './webhookVerification';
|
|
7
|
+
export { ChannelLister } from './channelLister';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/utils/number.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,MAK/C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processIncomingMsg.d.ts","sourceRoot":"","sources":["../../src/utils/processIncomingMsg.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAE7D,eAAO,MAAM,sBAAsB,GAAI,SAAS,kBAAkB,KAAG,UAAU,GAAG,IAiEjF,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import EventEmitter from 'node:events';
|
|
2
|
+
import type { GHLOAuthTokens } from '~/types';
|
|
3
|
+
/**
|
|
4
|
+
* Manages OAuth2 tokens for GoHighLevel API
|
|
5
|
+
* Handles token exchange, refresh, validation, and automatic renewal
|
|
6
|
+
* @emits tokens_updated - When tokens are refreshed
|
|
7
|
+
* @emits token_error - When token operations fail
|
|
8
|
+
*/
|
|
9
|
+
export declare class TokenManager extends EventEmitter {
|
|
10
|
+
private accessToken;
|
|
11
|
+
private refreshToken;
|
|
12
|
+
private clientId;
|
|
13
|
+
private clientSecret;
|
|
14
|
+
private redirectUri;
|
|
15
|
+
private expiresAt;
|
|
16
|
+
private refreshTimer;
|
|
17
|
+
private refreshPromise;
|
|
18
|
+
constructor(clientId: string, clientSecret: string, redirectUri?: string);
|
|
19
|
+
getAccessToken(): string;
|
|
20
|
+
getRefreshToken(): string;
|
|
21
|
+
isTokenExpired(): boolean;
|
|
22
|
+
setTokens(tokens: Partial<GHLOAuthTokens>): void;
|
|
23
|
+
/** Exchanges an authorization code for access and refresh tokens */
|
|
24
|
+
exchangeAuthorizationCode(code: string): Promise<GHLOAuthTokens>;
|
|
25
|
+
refreshAccessToken(): Promise<GHLOAuthTokens>;
|
|
26
|
+
private _doRefresh;
|
|
27
|
+
getValidToken(): Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Validates the current access token by making an API call to GHL.
|
|
30
|
+
* Returns true if token is valid, false if invalid/expired.
|
|
31
|
+
*/
|
|
32
|
+
validateToken(): Promise<boolean>;
|
|
33
|
+
private scheduleRefresh;
|
|
34
|
+
destroy(): void;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=tokenManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenManager.d.ts","sourceRoot":"","sources":["../../src/utils/tokenManager.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,aAAa,CAAA;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAK7C;;;;;GAKG;AACH,qBAAa,YAAa,SAAQ,YAAY;IAC1C,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,YAAY,CAA6C;IACjE,OAAO,CAAC,cAAc,CAAuC;gBAEjD,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,GAAE,MAAW;IAO5E,cAAc,IAAI,MAAM;IAIxB,eAAe,IAAI,MAAM;IAIzB,cAAc,IAAI,OAAO;IAIzB,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI;IAShD,oEAAoE;IAC9D,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAoBhE,kBAAkB,IAAI,OAAO,CAAC,cAAc,CAAC;YAkBrC,UAAU;IAwBlB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAOtC;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;IAqBvC,OAAO,CAAC,eAAe;IAiBvB,OAAO,IAAI,IAAI;CAOlB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verifies the webhook signature using HMAC SHA256.
|
|
3
|
+
* GoHighLevel sends the signature in the 'x-ghl-signature' header.
|
|
4
|
+
*
|
|
5
|
+
* @param payload - The raw request body as a string
|
|
6
|
+
* @param signature - The signature from the request header
|
|
7
|
+
* @param secret - The webhook secret (typically the client secret)
|
|
8
|
+
* @returns true if the signature is valid, false otherwise
|
|
9
|
+
*/
|
|
10
|
+
export declare const verifyWebhookSignature: (payload: string, signature: string, secret: string) => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Extracts the signature from the request headers.
|
|
13
|
+
* Supports common header formats used by GoHighLevel.
|
|
14
|
+
* Header names are case-insensitive per HTTP spec.
|
|
15
|
+
*
|
|
16
|
+
* @param headers - The request headers object
|
|
17
|
+
* @returns The signature string or null if not found
|
|
18
|
+
*/
|
|
19
|
+
export declare const extractSignatureFromHeaders: (headers: Record<string, string | undefined>) => string | null;
|
|
20
|
+
//# sourceMappingURL=webhookVerification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhookVerification.d.ts","sourceRoot":"","sources":["../../src/utils/webhookVerification.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GAAI,SAAS,MAAM,EAAE,WAAW,MAAM,EAAE,QAAQ,MAAM,KAAG,OAoB3F,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,GAAI,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,KAAG,MAAM,GAAG,IAsBlG,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@builderbot/provider-gohighlevel",
|
|
3
|
+
"version": "1.3.15-alpha.11",
|
|
4
|
+
"description": "GoHighLevel provider for builderbot - supports SMS, WhatsApp, Email, Live Chat and more channels via GHL API v2",
|
|
5
|
+
"author": "codigoencasa",
|
|
6
|
+
"homepage": "https://github.com/codigoencasa/builderbot#readme",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"main": "dist/index.cjs",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"directories": {
|
|
12
|
+
"src": "src",
|
|
13
|
+
"test": "__tests__"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"./dist/"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/codigoencasa/builderbot.git"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "rimraf dist && rollup --config",
|
|
24
|
+
"test": "jest",
|
|
25
|
+
"test:coverage": "jest --coverage",
|
|
26
|
+
"test:watch": "jest --watchAll --coverage"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/codigoencasa/builderbot/issues"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"axios": "^1.13.2",
|
|
33
|
+
"body-parser": "^2.2.1",
|
|
34
|
+
"file-type": "^19.0.0",
|
|
35
|
+
"form-data": "^4.0.5",
|
|
36
|
+
"mime-types": "^3.0.2",
|
|
37
|
+
"polka": "^0.5.2",
|
|
38
|
+
"queue-promise": "^2.2.1"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@builderbot/bot": "^1.3.15-alpha.11",
|
|
42
|
+
"@jest/globals": "^30.2.0",
|
|
43
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
44
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
45
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
46
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
47
|
+
"@types/jest": "^30.0.0",
|
|
48
|
+
"@types/node": "^24.10.2",
|
|
49
|
+
"@types/polka": "^0.5.7",
|
|
50
|
+
"jest": "^30.2.0",
|
|
51
|
+
"rimraf": "^6.1.2",
|
|
52
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
53
|
+
"ts-jest": "^29.4.6",
|
|
54
|
+
"tslib": "^2.6.2"
|
|
55
|
+
},
|
|
56
|
+
"gitHead": "4c82bc8e42da0ec2032d6ebbfaadb4ab08724292"
|
|
57
|
+
}
|