@scout9/admin 1.0.1 → 1.0.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/package.json +12 -3
- package/src/api.ts +3735 -95
- package/src/base.ts +34 -17
- package/src/common.ts +73 -59
- package/src/configuration.ts +92 -115
- package/src/index.ts +16 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/api-openai.d.ts +0 -2992
- package/build/api-openai.js +0 -1968
- package/build/api.d.ts +0 -78
- package/build/api.js +0 -90
- package/build/base.d.ts +0 -43
- package/build/base.js +0 -52
- package/build/common.d.ts +0 -54
- package/build/common.js +0 -132
- package/build/configuration.d.ts +0 -84
- package/build/configuration.js +0 -106
- package/build/index.d.ts +0 -2
- package/build/index.js +0 -18
- package/build/schemas/common/algolia.d.ts +0 -20
- package/build/schemas/common/algolia.js +0 -2
- package/build/schemas/common/contact-map.d.ts +0 -33
- package/build/schemas/common/contact-map.js +0 -2
- package/build/schemas/common/currency.d.ts +0 -1
- package/build/schemas/common/currency.js +0 -2
- package/build/schemas/common/index.d.ts +0 -6
- package/build/schemas/common/index.js +0 -22
- package/build/schemas/common/location.d.ts +0 -5
- package/build/schemas/common/location.js +0 -2
- package/build/schemas/common/task.d.ts +0 -20
- package/build/schemas/common/task.js +0 -2
- package/build/schemas/common/time.d.ts +0 -14
- package/build/schemas/common/time.js +0 -2
- package/build/schemas/common.d.ts +0 -77
- package/build/schemas/common.js +0 -8
- package/build/schemas/conversations/context.d.ts +0 -55
- package/build/schemas/conversations/context.js +0 -2
- package/build/schemas/conversations/conversation.d.ts +0 -53
- package/build/schemas/conversations/conversation.js +0 -2
- package/build/schemas/conversations/index.d.ts +0 -6
- package/build/schemas/conversations/index.js +0 -22
- package/build/schemas/conversations/message.d.ts +0 -62
- package/build/schemas/conversations/message.js +0 -2
- package/build/schemas/conversations/parsed.d.ts +0 -7
- package/build/schemas/conversations/parsed.js +0 -2
- package/build/schemas/conversations/scheduled-conversation.d.ts +0 -31
- package/build/schemas/conversations/scheduled-conversation.js +0 -2
- package/build/schemas/conversations/webhook.d.ts +0 -8
- package/build/schemas/conversations/webhook.js +0 -2
- package/build/schemas/index.d.ts +0 -3
- package/build/schemas/index.js +0 -19
- package/build/schemas/users/businesses/agents/agent.d.ts +0 -76
- package/build/schemas/users/businesses/agents/agent.js +0 -2
- package/build/schemas/users/businesses/agents/auth.d.ts +0 -7
- package/build/schemas/users/businesses/agents/auth.js +0 -2
- package/build/schemas/users/businesses/agents/index.d.ts +0 -2
- package/build/schemas/users/businesses/agents/index.js +0 -18
- package/build/schemas/users/businesses/business-location.d.ts +0 -10
- package/build/schemas/users/businesses/business-location.js +0 -2
- package/build/schemas/users/businesses/business.d.ts +0 -32
- package/build/schemas/users/businesses/business.js +0 -2
- package/build/schemas/users/businesses/context/context-indexed.d.ts +0 -9
- package/build/schemas/users/businesses/context/context-indexed.js +0 -2
- package/build/schemas/users/businesses/context/context-saves.d.ts +0 -12
- package/build/schemas/users/businesses/context/context-saves.js +0 -2
- package/build/schemas/users/businesses/context/context.d.ts +0 -64
- package/build/schemas/users/businesses/context/context.js +0 -2
- package/build/schemas/users/businesses/context/index.d.ts +0 -2
- package/build/schemas/users/businesses/context/index.js +0 -18
- package/build/schemas/users/businesses/index.d.ts +0 -5
- package/build/schemas/users/businesses/index.js +0 -21
- package/build/schemas/users/businesses/notifications.d.ts +0 -7
- package/build/schemas/users/businesses/notifications.js +0 -2
- package/build/schemas/users/businesses/offerings/index.d.ts +0 -2
- package/build/schemas/users/businesses/offerings/index.js +0 -18
- package/build/schemas/users/businesses/offerings/offer-indexed.d.ts +0 -34
- package/build/schemas/users/businesses/offerings/offer-indexed.js +0 -2
- package/build/schemas/users/businesses/offerings/offer.d.ts +0 -29
- package/build/schemas/users/businesses/offerings/offer.js +0 -2
- package/build/schemas/users/businesses/thread.d.ts +0 -44
- package/build/schemas/users/businesses/thread.js +0 -2
- package/build/schemas/users/customers/customer.d.ts +0 -35
- package/build/schemas/users/customers/customer.js +0 -2
- package/build/schemas/users/customers/index.d.ts +0 -1
- package/build/schemas/users/customers/index.js +0 -17
- package/build/schemas/users/index.d.ts +0 -2
- package/build/schemas/users/index.js +0 -18
- package/src/api-openai.txt +0 -4117
- package/src/schemas/common/algolia.ts +0 -24
- package/src/schemas/common/contact-map.ts +0 -35
- package/src/schemas/common/currency.ts +0 -1
- package/src/schemas/common/index.ts +0 -6
- package/src/schemas/common/location.ts +0 -6
- package/src/schemas/common/task.ts +0 -26
- package/src/schemas/common/time.ts +0 -15
- package/src/schemas/common.ts +0 -94
- package/src/schemas/conversations/context.ts +0 -64
- package/src/schemas/conversations/conversation.ts +0 -68
- package/src/schemas/conversations/index.ts +0 -6
- package/src/schemas/conversations/message.ts +0 -78
- package/src/schemas/conversations/parsed.ts +0 -5
- package/src/schemas/conversations/scheduled-conversation.ts +0 -35
- package/src/schemas/conversations/webhook.ts +0 -10
- package/src/schemas/index.ts +0 -3
- package/src/schemas/users/businesses/agents/agent.ts +0 -107
- package/src/schemas/users/businesses/agents/auth.ts +0 -8
- package/src/schemas/users/businesses/agents/index.ts +0 -2
- package/src/schemas/users/businesses/business-location.ts +0 -15
- package/src/schemas/users/businesses/business.ts +0 -43
- package/src/schemas/users/businesses/context/context-indexed.ts +0 -11
- package/src/schemas/users/businesses/context/context-saves.ts +0 -14
- package/src/schemas/users/businesses/context/context.ts +0 -76
- package/src/schemas/users/businesses/context/index.ts +0 -2
- package/src/schemas/users/businesses/index.ts +0 -6
- package/src/schemas/users/businesses/notifications.ts +0 -12
- package/src/schemas/users/businesses/offerings/index.ts +0 -2
- package/src/schemas/users/businesses/offerings/offer-indexed.ts +0 -42
- package/src/schemas/users/businesses/offerings/offer.ts +0 -39
- package/src/schemas/users/businesses/thread.ts +0 -55
- package/src/schemas/users/customers/customer.ts +0 -46
- package/src/schemas/users/customers/index.ts +0 -1
- package/src/schemas/users/index.ts +0 -2
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Helper schedule to bridge algolia records with internal db
|
|
3
|
-
*/
|
|
4
|
-
export interface IAlgoliaIndexedObject {
|
|
5
|
-
/**
|
|
6
|
-
* Where this object is stored in the database
|
|
7
|
-
*/
|
|
8
|
-
parent: string;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Algolia objectID required
|
|
12
|
-
*/
|
|
13
|
-
objectID: string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Algolia geolocation for a given object
|
|
18
|
-
*/
|
|
19
|
-
_geoloc?: {
|
|
20
|
-
lat: number;
|
|
21
|
-
lng: number;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { EmailServiceType } from '../users';
|
|
2
|
-
|
|
3
|
-
export interface IContactPath {
|
|
4
|
-
id: string;
|
|
5
|
-
path: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* A utility helper collection to map contact information to a common format.
|
|
9
|
-
*
|
|
10
|
-
* scout9-contact-map/{contact}
|
|
11
|
-
*/
|
|
12
|
-
export interface IContactMap {
|
|
13
|
-
/**
|
|
14
|
-
* Can either be the formatted phone number or email address.
|
|
15
|
-
*/
|
|
16
|
-
contact: string;
|
|
17
|
-
agentPaths: {
|
|
18
|
-
businessId: string;
|
|
19
|
-
agentId: string;
|
|
20
|
-
}[];
|
|
21
|
-
customerPaths: {
|
|
22
|
-
businessId: string;
|
|
23
|
-
customerId: string;
|
|
24
|
-
}[];
|
|
25
|
-
|
|
26
|
-
programmableEmailProps?: {
|
|
27
|
-
type: EmailServiceType;
|
|
28
|
-
/**
|
|
29
|
-
* If this email is a gmail email, then we can store the refresh token (after they O-Auth) here so that we can run gmail.contacts.watch
|
|
30
|
-
* @TODO - create a O-Auth flow for this, see scripts/gmail/generate-refresh-token for an example
|
|
31
|
-
*/
|
|
32
|
-
gmailRefreshToken?: string;
|
|
33
|
-
gmailWatchExpiration?: string;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type Currency = 'usd' | 'cad';
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Timestamp } from '../common';
|
|
2
|
-
|
|
3
|
-
export interface ITask {
|
|
4
|
-
/**
|
|
5
|
-
* Unique token for processing
|
|
6
|
-
*/
|
|
7
|
-
token?: string;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Time when the task was created
|
|
11
|
-
*/
|
|
12
|
-
time: Timestamp;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* When was the task completed
|
|
17
|
-
*/
|
|
18
|
-
completed?: Timestamp;
|
|
19
|
-
|
|
20
|
-
retries?: number;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface IQueueTask {
|
|
24
|
-
token: string;
|
|
25
|
-
taskPath: string;
|
|
26
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import moment from 'moment';
|
|
2
|
-
import { ISOString, Timestamp } from '../common';
|
|
3
|
-
|
|
4
|
-
export interface ITimeRange {
|
|
5
|
-
from: ISOString;
|
|
6
|
-
to: ISOString;
|
|
7
|
-
}
|
|
8
|
-
export interface ITimeRangeTimestamp {
|
|
9
|
-
from: Timestamp;
|
|
10
|
-
to: Timestamp;
|
|
11
|
-
}
|
|
12
|
-
export interface ITimeRangeMoment {
|
|
13
|
-
from: moment.Moment;
|
|
14
|
-
to: moment.Moment;
|
|
15
|
-
}
|
package/src/schemas/common.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
export type Timestamp = any;
|
|
2
|
-
export type ISOString = string;
|
|
3
|
-
|
|
4
|
-
export type MessageStatus = 'queued'|'sending'|'sent'|'failed'|'delivered'|'undelivered'|'receiving'|'received'|'accepted'|'scheduled'|'read'|'partially_delivered'|'canceled';
|
|
5
|
-
|
|
6
|
-
export const ChatCompletionRequestMessageRoleEnum = {
|
|
7
|
-
System: 'system',
|
|
8
|
-
User: 'user',
|
|
9
|
-
Assistant: 'assistant'
|
|
10
|
-
} as const;
|
|
11
|
-
|
|
12
|
-
export type ChatCompletionRequestMessageRoleEnum = typeof ChatCompletionRequestMessageRoleEnum[keyof typeof ChatCompletionRequestMessageRoleEnum];
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export interface ChatCompletionRequestMessage {
|
|
16
|
-
/**
|
|
17
|
-
* The role of the author of this message.
|
|
18
|
-
* @type {string}
|
|
19
|
-
* @memberof ChatCompletionRequestMessage
|
|
20
|
-
*/
|
|
21
|
-
'role': ChatCompletionRequestMessageRoleEnum;
|
|
22
|
-
/**
|
|
23
|
-
* The contents of the message
|
|
24
|
-
* @type {string}
|
|
25
|
-
* @memberof ChatCompletionRequestMessage
|
|
26
|
-
*/
|
|
27
|
-
'content': string;
|
|
28
|
-
/**
|
|
29
|
-
* The name of the user in a multi-user chat
|
|
30
|
-
* @type {string}
|
|
31
|
-
* @memberof ChatCompletionRequestMessage
|
|
32
|
-
*/
|
|
33
|
-
'name'?: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export module Stripe {
|
|
38
|
-
export interface Address {
|
|
39
|
-
/**
|
|
40
|
-
* City/District/Suburb/Town/Village.
|
|
41
|
-
*/
|
|
42
|
-
city: string | null;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* 2-letter country code.
|
|
46
|
-
*/
|
|
47
|
-
country: string | null;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Address line 1 (Street address/PO Box/Company name).
|
|
51
|
-
*/
|
|
52
|
-
line1: string | null;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Address line 2 (Apartment/Suite/Unit/Building).
|
|
56
|
-
*/
|
|
57
|
-
line2: string | null;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* ZIP or postal code.
|
|
61
|
-
*/
|
|
62
|
-
postal_code: string | null;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* State/County/Province/Region.
|
|
66
|
-
*/
|
|
67
|
-
state: string | null;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Helper schedule to bridge algolia records with internal db
|
|
73
|
-
*/
|
|
74
|
-
export interface IAlgoliaIndexedObject {
|
|
75
|
-
/**
|
|
76
|
-
* Where this object is stored in the database
|
|
77
|
-
*/
|
|
78
|
-
parent: string;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Algolia objectID required
|
|
82
|
-
*/
|
|
83
|
-
objectID: string;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Algolia geolocation for a given object
|
|
88
|
-
*/
|
|
89
|
-
_geoloc?: {
|
|
90
|
-
lat: number;
|
|
91
|
-
lng: number;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Timestamp } from '../common';
|
|
2
|
-
import { ConversationParsed } from './parsed';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Used to put 'system' messages into the conversation
|
|
6
|
-
* scout9-conversations/{conversationId}/context/{contextId}
|
|
7
|
-
*/
|
|
8
|
-
export interface IConversationContextField {
|
|
9
|
-
id: string;
|
|
10
|
-
/**
|
|
11
|
-
* Gets added to the message under role 'system'
|
|
12
|
-
*/
|
|
13
|
-
time: Timestamp;
|
|
14
|
-
context: string;
|
|
15
|
-
note?: string;
|
|
16
|
-
metadata?: {[key: string]: any};
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Conditional that need to be met in order for this context to be apart of the conversation
|
|
20
|
-
*/
|
|
21
|
-
conditions?: IConversationContextGroup[];
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* If all conditions are met, then it will trigger the following API keys
|
|
25
|
-
* If [info.triggers[i]] exists, then it should not trigger
|
|
26
|
-
*/
|
|
27
|
-
triggers?: string[];
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Used to group context fields together
|
|
33
|
-
*/
|
|
34
|
-
export interface IConversationContextGroup {
|
|
35
|
-
conditions: IConversationContextFieldCondition[];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Based on the data from scout9-conversations/{uid}/conversations/{convoId}/info/default
|
|
40
|
-
* Checks to see if that data meets the given condition in order to release the API call
|
|
41
|
-
*/
|
|
42
|
-
export interface IConversationContextFieldCondition {
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* What field in the conversation info is being checked
|
|
46
|
-
*/
|
|
47
|
-
key: keyof ConversationParsed;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Operator to evaluate the info[key] against the conditional value
|
|
51
|
-
*/
|
|
52
|
-
operator: 'eq' | '==' | 'neq' | '!=' | 'gt' | '>' | 'gte' | '>=' | 'lt' | '<' | 'lte' | '<=' | 'in' | 'nin' | 'exists' | '!!' | 'notExists' | '!' | 'contains' | 'notContains' | 'startsWith' | 'endsWith';
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* If provided, it will skip operator check and use the regex to check the value
|
|
56
|
-
*/
|
|
57
|
-
regex?: string;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* What is the value being checked
|
|
61
|
-
*/
|
|
62
|
-
value: string | number | boolean | null | string[] | number[] | boolean[];
|
|
63
|
-
|
|
64
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Timestamp } from '../common';
|
|
2
|
-
import { EmailServiceType, IThread } from '../users';
|
|
3
|
-
import { ConversationEnvironment } from './message';
|
|
4
|
-
|
|
5
|
-
export interface IConversationEnvironmentProps {
|
|
6
|
-
|
|
7
|
-
subject?: string;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Used to sync email messages with the conversation
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
platformEmailThreadId?: string;
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* scout9-conversations/{conversationId}
|
|
18
|
-
*
|
|
19
|
-
* A two way conversation between a customer and a businesses agents
|
|
20
|
-
*/
|
|
21
|
-
export interface IConversation extends Pick<IThread, 'onCreated' | 'onDeleted' | 'onUpdated' | 'onError'> {
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Customer this conversation is with
|
|
25
|
-
* scout9-businesses/{$business}/customers/{$customer}
|
|
26
|
-
*/
|
|
27
|
-
$customer: string;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Business this conversation is with
|
|
31
|
-
* scout9-businesses/{$businesses}
|
|
32
|
-
*/
|
|
33
|
-
$business: string;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Agent assigned to this conversation
|
|
37
|
-
* scout9-businesses/{$businesses}/agents/{$agents}
|
|
38
|
-
*/
|
|
39
|
-
$agent: string;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Thread this conversation is in - this determines what context to pull when loading the conversation
|
|
43
|
-
* scout9-businesses/{$businesses}/threads/{$threads}
|
|
44
|
-
*/
|
|
45
|
-
$thread: string;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* When the conversation is created, append these contexts to the conversation
|
|
49
|
-
*/
|
|
50
|
-
initialContexts?: string[];
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
initiated: Timestamp;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* What parser functions to run for this conversation, by default will parse core fields
|
|
57
|
-
*/
|
|
58
|
-
parse?: string[];
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* What this environment is intended for
|
|
63
|
-
* Defaults to 'web'
|
|
64
|
-
*/
|
|
65
|
-
environment?: ConversationEnvironment;
|
|
66
|
-
environmentProps?: IConversationEnvironmentProps;
|
|
67
|
-
|
|
68
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { ChatCompletionRequestMessage, MessageStatus, Timestamp } from '../common';
|
|
2
|
-
import { IConversationContextField } from './context';
|
|
3
|
-
import { ConversationParsed } from './parsed';
|
|
4
|
-
|
|
5
|
-
export type ConversationEnvironment = 'phone' | 'web' | 'email';
|
|
6
|
-
|
|
7
|
-
export interface IConversationMessageEmailProps {
|
|
8
|
-
/**
|
|
9
|
-
* The platform that this message was sent from the assigned agent in the conversation
|
|
10
|
-
* (this is used to help with sync/identification mainly getting the global Message-ID)
|
|
11
|
-
*/
|
|
12
|
-
platformMessageId?: string;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The global message id that this message states in email headers 'Message-ID'
|
|
16
|
-
*/
|
|
17
|
-
globalMessageId?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export interface IConversationMessage extends ChatCompletionRequestMessage {
|
|
22
|
-
|
|
23
|
-
time: Timestamp;
|
|
24
|
-
|
|
25
|
-
contentHtml?: string;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* When the message is created we parse the message for relevant fields
|
|
29
|
-
*/
|
|
30
|
-
parsed?: ConversationParsed;
|
|
31
|
-
/**
|
|
32
|
-
* Time at which the parsed information was processed
|
|
33
|
-
*/
|
|
34
|
-
parsedLoaded?: Timestamp;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The message we are replying to
|
|
38
|
-
*/
|
|
39
|
-
replyTo?: string;
|
|
40
|
-
|
|
41
|
-
emailEnvironmentProps?: IConversationMessageEmailProps;
|
|
42
|
-
smsEnvironmentProps?: {
|
|
43
|
-
twilioMessageId: string;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* @TODO the existence of this field being being perceived as an indication that the message
|
|
47
|
-
* was recived by the client, this should be changed and handled properly
|
|
48
|
-
*/
|
|
49
|
-
receipt?: IConversationMessageReceipt;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @TODO remove this in production as it will bloat the database
|
|
53
|
-
*/
|
|
54
|
-
context?: IConversationContextField[];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface IConversationMessageReceipt {
|
|
58
|
-
environment: {
|
|
59
|
-
type: 'phone';
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Twilio message id
|
|
63
|
-
*/
|
|
64
|
-
sid: string
|
|
65
|
-
status: MessageStatus;
|
|
66
|
-
} | {
|
|
67
|
-
type: 'web';
|
|
68
|
-
} | {
|
|
69
|
-
type: 'email';
|
|
70
|
-
|
|
71
|
-
status: 'sent' | 'received';
|
|
72
|
-
};
|
|
73
|
-
time: Timestamp;
|
|
74
|
-
|
|
75
|
-
// Errors
|
|
76
|
-
error?: string;
|
|
77
|
-
errorCode?: string;
|
|
78
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Timestamp } from '../common';
|
|
2
|
-
import { IConversation } from './conversation';
|
|
3
|
-
import { ConversationEnvironment } from './message';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* scout9-scheduled-conversations/{conversationId}
|
|
7
|
-
* When a conversation is scheduled to be sent at a later time
|
|
8
|
-
*/
|
|
9
|
-
export interface IScheduledConversation extends IConversation {
|
|
10
|
-
scheduled: Timestamp;
|
|
11
|
-
initialMessage: string;
|
|
12
|
-
initialMessageHtml?: string;
|
|
13
|
-
sent?: Timestamp;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Attached to a schedule group
|
|
17
|
-
* scout9-scheduled-conversation-groups/{groupId}
|
|
18
|
-
*/
|
|
19
|
-
$group?: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* scout9-scheduled-conversation-groups/{groupId}
|
|
24
|
-
*/
|
|
25
|
-
export interface IScheduledGroupConversation extends Omit<IScheduledConversation, '$customer' | 'environment' | '$group'> {
|
|
26
|
-
customers: {
|
|
27
|
-
environment: ConversationEnvironment;
|
|
28
|
-
id: string;
|
|
29
|
-
}[];
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* How much we should delay between schedules, defaults to 15000 (15 seconds)
|
|
33
|
-
*/
|
|
34
|
-
delay?: number;
|
|
35
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IConversationMessage } from './message';
|
|
2
|
-
import { ConversationParsed } from './parsed';
|
|
3
|
-
|
|
4
|
-
export type MessageWebhookType = 'conversation.scheduled' | 'conversation.created' | 'conversation.updated' | 'conversation.deleted' | 'conversation.error' | 'conversation.message.created' | 'conversation.message.updated' | 'conversation.message.deleted' | 'conversation.message.error';
|
|
5
|
-
|
|
6
|
-
export interface IMessageWebhookResponse {
|
|
7
|
-
type: MessageWebhookType;
|
|
8
|
-
parsed?: ConversationParsed;
|
|
9
|
-
message?: IConversationMessage;
|
|
10
|
-
}
|
package/src/schemas/index.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* scout9-businesses/{businessId}/agents/{agentId}
|
|
3
|
-
*
|
|
4
|
-
* An agents is a person who works for a businesses
|
|
5
|
-
*/
|
|
6
|
-
export type EmailServiceType = 'sendgrid' | 'gmail' | 'outlook';
|
|
7
|
-
export interface IAgent {
|
|
8
|
-
|
|
9
|
-
img?: string;
|
|
10
|
-
firstName: string;
|
|
11
|
-
lastName: string;
|
|
12
|
-
|
|
13
|
-
inactive?: boolean;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Programmable phone number from Twilio
|
|
17
|
-
*/
|
|
18
|
-
programmablePhoneNumber?: string;
|
|
19
|
-
programmablePhoneNumberSid?: string;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Email address from Scout9 gmail subdomain
|
|
23
|
-
*/
|
|
24
|
-
programmableEmail?: string;
|
|
25
|
-
// programmableEmailProps?: {
|
|
26
|
-
// type: EmailServiceType;
|
|
27
|
-
// /**
|
|
28
|
-
// * If this email is a gmail email, then we can store the refresh token (after they O-Auth) here so that we can run gmail.contacts.watch
|
|
29
|
-
// * @TODO - create a O-Auth flow for this, see scripts/gmail/generate-refresh-token for an example
|
|
30
|
-
// */
|
|
31
|
-
// gmailRefreshToken?: string;
|
|
32
|
-
// gmailWatchExpiration?: string;
|
|
33
|
-
// }
|
|
34
|
-
|
|
35
|
-
forwardEmail?: string;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* All agents must have a phone number (used to login)
|
|
39
|
-
*/
|
|
40
|
-
forwardPhone: string;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Whether or not this agent has been verified by the business.
|
|
44
|
-
*/
|
|
45
|
-
// verified?: boolean;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Title of the agent, defaults to "Agent"
|
|
49
|
-
*/
|
|
50
|
-
title: string;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* In 1 sentence, what does this agent do for customers.
|
|
54
|
-
*/
|
|
55
|
-
context: string;
|
|
56
|
-
|
|
57
|
-
// /**
|
|
58
|
-
// * What business does this agents work for?
|
|
59
|
-
// * scout9-businesses/{$business}
|
|
60
|
-
// */
|
|
61
|
-
// $business: string;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* If provided, this means they are part of these office locations. If not provided and excludedLocations not
|
|
65
|
-
* provided, we assume this agents can support all locations.
|
|
66
|
-
* scout9-businesses/{businessId}/locations/{...includedLocations}
|
|
67
|
-
*/
|
|
68
|
-
includedLocations?: string[];
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* If provided, this will take precedence over includedLocations.
|
|
72
|
-
* scout9-businesses/{businessId}/locations/{...excludedLocations}
|
|
73
|
-
*/
|
|
74
|
-
excludedLocations?: string[];
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* A base64 large string object of the transcript, for example if the agents name is "Jeff", then the decoded transcript would be:
|
|
79
|
-
*
|
|
80
|
-
* Format 1:
|
|
81
|
-
*
|
|
82
|
-
* Jeff: Hey Bill, so you need help with you car?
|
|
83
|
-
*
|
|
84
|
-
* Bill: Yes, I need to get my car fixed
|
|
85
|
-
*
|
|
86
|
-
* Jeff: Ok, what's the problem?
|
|
87
|
-
*
|
|
88
|
-
* Format 2:
|
|
89
|
-
*
|
|
90
|
-
* [Jeff] Hey Bill, so you need help with you car?
|
|
91
|
-
*
|
|
92
|
-
* [Bill] Yes, I need to get my car fixed
|
|
93
|
-
*
|
|
94
|
-
* [Jeff] Ok, what's the problem?
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* The agents name "Jeff" must match exact the agents name in the database, otherwise it won't work.
|
|
99
|
-
*/
|
|
100
|
-
transcript?: string;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Firebase storage reference to the audio file if available
|
|
104
|
-
*/
|
|
105
|
-
audioRef?: string;
|
|
106
|
-
|
|
107
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Stripe } from '../../common';
|
|
2
|
-
import { ILocation } from '../../common/location';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* scout9-businesses/{businessId}/locations/{locationId}
|
|
7
|
-
*/
|
|
8
|
-
export interface IBusinessLocation extends ILocation, Stripe.Address {
|
|
9
|
-
name: string;
|
|
10
|
-
|
|
11
|
-
areaCodes?: number[] | null;
|
|
12
|
-
|
|
13
|
-
twilioAddressSid?: string;
|
|
14
|
-
|
|
15
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* scout9-businesses/{businessId}
|
|
3
|
-
*/
|
|
4
|
-
export interface IBusiness {
|
|
5
|
-
name: string;
|
|
6
|
-
|
|
7
|
-
logo?: string;
|
|
8
|
-
icon?: string;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* User id of the owner of this account
|
|
12
|
-
*/
|
|
13
|
-
$owner: string;
|
|
14
|
-
phone: string;
|
|
15
|
-
email: string;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* 1 sentence what does this business do?
|
|
19
|
-
*/
|
|
20
|
-
context: string;
|
|
21
|
-
|
|
22
|
-
apiKey?: string;
|
|
23
|
-
|
|
24
|
-
website?: string;
|
|
25
|
-
|
|
26
|
-
webhookUrl?: string;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Stripe customer ids for charging subscriptions
|
|
31
|
-
*/
|
|
32
|
-
stripeCustomer?: string;
|
|
33
|
-
stripeCustomerDev?: string;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Stripe connect ids for charging customers on behalf of Scout9
|
|
37
|
-
*/
|
|
38
|
-
stripeConnect?: string;
|
|
39
|
-
stripeConnectDev?: string;
|
|
40
|
-
|
|
41
|
-
twilioAddressSid?: string;
|
|
42
|
-
|
|
43
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IAlgoliaIndexedObject } from '../../../common';
|
|
2
|
-
import { IContext } from './context';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* scout9-businesses/{businessId}/context-indexed/{context}
|
|
6
|
-
* An auto generated context, when a context category is created it will be indexed in a collection, resolving all stripe and
|
|
7
|
-
* algolia references.
|
|
8
|
-
*/
|
|
9
|
-
export interface IContextIndexed extends IContext, IAlgoliaIndexedObject {
|
|
10
|
-
|
|
11
|
-
}
|