@inkbox/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +369 -0
- package/dist/_http.d.ts +24 -0
- package/dist/_http.d.ts.map +1 -0
- package/dist/_http.js +90 -0
- package/dist/_http.js.map +1 -0
- package/dist/agent_identity.d.ts +184 -0
- package/dist/agent_identity.d.ts.map +1 -0
- package/dist/agent_identity.js +262 -0
- package/dist/agent_identity.js.map +1 -0
- package/dist/identities/resources/identities.d.ts +80 -0
- package/dist/identities/resources/identities.d.ts.map +1 -0
- package/dist/identities/resources/identities.js +103 -0
- package/dist/identities/resources/identities.js.map +1 -0
- package/dist/identities/types.d.ts +77 -0
- package/dist/identities/types.d.ts.map +1 -0
- package/dist/identities/types.js +44 -0
- package/dist/identities/types.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/inkbox.d.ts +92 -0
- package/dist/inkbox.d.ts.map +1 -0
- package/dist/inkbox.js +117 -0
- package/dist/inkbox.js.map +1 -0
- package/dist/mail/resources/mailboxes.d.ts +61 -0
- package/dist/mail/resources/mailboxes.d.ts.map +1 -0
- package/dist/mail/resources/mailboxes.js +83 -0
- package/dist/mail/resources/mailboxes.js.map +1 -0
- package/dist/mail/resources/messages.d.ts +100 -0
- package/dist/mail/resources/messages.d.ts.map +1 -0
- package/dist/mail/resources/messages.js +141 -0
- package/dist/mail/resources/messages.js.map +1 -0
- package/dist/mail/resources/threads.d.ts +36 -0
- package/dist/mail/resources/threads.d.ts.map +1 -0
- package/dist/mail/resources/threads.js +53 -0
- package/dist/mail/resources/threads.js.map +1 -0
- package/dist/mail/types.d.ts +113 -0
- package/dist/mail/types.d.ts.map +1 -0
- package/dist/mail/types.js +65 -0
- package/dist/mail/types.js.map +1 -0
- package/dist/phone/resources/calls.d.ts +45 -0
- package/dist/phone/resources/calls.d.ts.map +1 -0
- package/dist/phone/resources/calls.js +57 -0
- package/dist/phone/resources/calls.js.map +1 -0
- package/dist/phone/resources/numbers.d.ts +61 -0
- package/dist/phone/resources/numbers.d.ts.map +1 -0
- package/dist/phone/resources/numbers.js +85 -0
- package/dist/phone/resources/numbers.js.map +1 -0
- package/dist/phone/resources/transcripts.d.ts +19 -0
- package/dist/phone/resources/transcripts.d.ts.map +1 -0
- package/dist/phone/resources/transcripts.js +23 -0
- package/dist/phone/resources/transcripts.js.map +1 -0
- package/dist/phone/types.d.ts +108 -0
- package/dist/phone/types.d.ts.map +1 -0
- package/dist/phone/types.js +62 -0
- package/dist/phone/types.js.map +1 -0
- package/dist/signing_keys.d.ts +40 -0
- package/dist/signing_keys.d.ts.map +1 -0
- package/dist/signing_keys.js +59 -0
- package/dist/signing_keys.js.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inkbox/src/agent.ts
|
|
3
|
+
*
|
|
4
|
+
* AgentIdentity — a domain object representing one agent identity.
|
|
5
|
+
* Returned by inkbox.createIdentity() and inkbox.getIdentity().
|
|
6
|
+
*
|
|
7
|
+
* Convenience methods (sendEmail, placeCall, etc.) are scoped to this
|
|
8
|
+
* identity's assigned channels so callers never need to pass an email
|
|
9
|
+
* address or phone number ID explicitly.
|
|
10
|
+
*/
|
|
11
|
+
import { InkboxAPIError } from "./_http.js";
|
|
12
|
+
export class AgentIdentity {
|
|
13
|
+
_data;
|
|
14
|
+
_inkbox;
|
|
15
|
+
_mailbox;
|
|
16
|
+
_phoneNumber;
|
|
17
|
+
constructor(data, inkbox) {
|
|
18
|
+
this._data = data;
|
|
19
|
+
this._inkbox = inkbox;
|
|
20
|
+
this._mailbox = data.mailbox;
|
|
21
|
+
this._phoneNumber = data.phoneNumber;
|
|
22
|
+
}
|
|
23
|
+
// ------------------------------------------------------------------
|
|
24
|
+
// Identity properties
|
|
25
|
+
// ------------------------------------------------------------------
|
|
26
|
+
get agentHandle() { return this._data.agentHandle; }
|
|
27
|
+
get id() { return this._data.id; }
|
|
28
|
+
get status() { return this._data.status; }
|
|
29
|
+
/** The mailbox currently assigned to this identity, or `null` if none. */
|
|
30
|
+
get mailbox() { return this._mailbox; }
|
|
31
|
+
/** The phone number currently assigned to this identity, or `null` if none. */
|
|
32
|
+
get phoneNumber() { return this._phoneNumber; }
|
|
33
|
+
// ------------------------------------------------------------------
|
|
34
|
+
// Channel management
|
|
35
|
+
// ------------------------------------------------------------------
|
|
36
|
+
/**
|
|
37
|
+
* Create a new mailbox and link it to this identity.
|
|
38
|
+
*
|
|
39
|
+
* @param options.displayName - Optional human-readable sender name.
|
|
40
|
+
* @returns The newly created and linked {@link IdentityMailbox}.
|
|
41
|
+
*/
|
|
42
|
+
async createMailbox(options = {}) {
|
|
43
|
+
const mailbox = await this._inkbox._mailboxes.create(options);
|
|
44
|
+
const data = await this._inkbox._idsResource.assignMailbox(this.agentHandle, {
|
|
45
|
+
mailboxId: mailbox.id,
|
|
46
|
+
});
|
|
47
|
+
this._mailbox = data.mailbox;
|
|
48
|
+
this._data = data;
|
|
49
|
+
return this._mailbox;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Link an existing mailbox to this identity.
|
|
53
|
+
*
|
|
54
|
+
* @param mailboxId - UUID of the mailbox to link. Obtain via
|
|
55
|
+
* `inkbox.mailboxes.list()` or `inkbox.mailboxes.get()`.
|
|
56
|
+
* @returns The linked {@link IdentityMailbox}.
|
|
57
|
+
*/
|
|
58
|
+
async assignMailbox(mailboxId) {
|
|
59
|
+
const data = await this._inkbox._idsResource.assignMailbox(this.agentHandle, {
|
|
60
|
+
mailboxId,
|
|
61
|
+
});
|
|
62
|
+
this._mailbox = data.mailbox;
|
|
63
|
+
this._data = data;
|
|
64
|
+
return this._mailbox;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Unlink this identity's mailbox (does not delete the mailbox).
|
|
68
|
+
*/
|
|
69
|
+
async unlinkMailbox() {
|
|
70
|
+
this._requireMailbox();
|
|
71
|
+
await this._inkbox._idsResource.unlinkMailbox(this.agentHandle);
|
|
72
|
+
this._mailbox = null;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Provision a new phone number and link it to this identity.
|
|
76
|
+
*
|
|
77
|
+
* @param options.type - `"toll_free"` (default) or `"local"`.
|
|
78
|
+
* @param options.state - US state abbreviation (e.g. `"NY"`), valid for local numbers only.
|
|
79
|
+
* @returns The newly provisioned and linked {@link IdentityPhoneNumber}.
|
|
80
|
+
*/
|
|
81
|
+
async provisionPhoneNumber(options = {}) {
|
|
82
|
+
await this._inkbox._numbers.provision({ agentHandle: this.agentHandle, ...options });
|
|
83
|
+
const data = await this._inkbox._idsResource.get(this.agentHandle);
|
|
84
|
+
this._phoneNumber = data.phoneNumber;
|
|
85
|
+
this._data = data;
|
|
86
|
+
return this._phoneNumber;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Link an existing phone number to this identity.
|
|
90
|
+
*
|
|
91
|
+
* @param phoneNumberId - UUID of the phone number to link. Obtain via
|
|
92
|
+
* `inkbox.phoneNumbers.list()` or `inkbox.phoneNumbers.get()`.
|
|
93
|
+
* @returns The linked {@link IdentityPhoneNumber}.
|
|
94
|
+
*/
|
|
95
|
+
async assignPhoneNumber(phoneNumberId) {
|
|
96
|
+
const data = await this._inkbox._idsResource.assignPhoneNumber(this.agentHandle, {
|
|
97
|
+
phoneNumberId,
|
|
98
|
+
});
|
|
99
|
+
this._phoneNumber = data.phoneNumber;
|
|
100
|
+
this._data = data;
|
|
101
|
+
return this._phoneNumber;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Unlink this identity's phone number (does not release the number).
|
|
105
|
+
*/
|
|
106
|
+
async unlinkPhoneNumber() {
|
|
107
|
+
this._requirePhone();
|
|
108
|
+
await this._inkbox._idsResource.unlinkPhoneNumber(this.agentHandle);
|
|
109
|
+
this._phoneNumber = null;
|
|
110
|
+
}
|
|
111
|
+
// ------------------------------------------------------------------
|
|
112
|
+
// Mail helpers
|
|
113
|
+
// ------------------------------------------------------------------
|
|
114
|
+
/**
|
|
115
|
+
* Send an email from this identity's mailbox.
|
|
116
|
+
*
|
|
117
|
+
* @param options.to - Primary recipient addresses (at least one required).
|
|
118
|
+
* @param options.subject - Email subject line.
|
|
119
|
+
* @param options.bodyText - Plain-text body.
|
|
120
|
+
* @param options.bodyHtml - HTML body.
|
|
121
|
+
* @param options.cc - Carbon-copy recipients.
|
|
122
|
+
* @param options.bcc - Blind carbon-copy recipients.
|
|
123
|
+
* @param options.inReplyToMessageId - RFC 5322 Message-ID to thread a reply.
|
|
124
|
+
* @param options.attachments - File attachments.
|
|
125
|
+
*/
|
|
126
|
+
async sendEmail(options) {
|
|
127
|
+
this._requireMailbox();
|
|
128
|
+
return this._inkbox._messages.send(this._mailbox.emailAddress, options);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Iterate over emails in this identity's inbox, newest first.
|
|
132
|
+
*
|
|
133
|
+
* Pagination is handled automatically.
|
|
134
|
+
*
|
|
135
|
+
* @param options.pageSize - Messages fetched per API call (1–100). Defaults to 50.
|
|
136
|
+
* @param options.direction - Filter by `"inbound"` or `"outbound"`.
|
|
137
|
+
*/
|
|
138
|
+
iterEmails(options = {}) {
|
|
139
|
+
this._requireMailbox();
|
|
140
|
+
return this._inkbox._messages.list(this._mailbox.emailAddress, options);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Iterate over unread emails in this identity's inbox, newest first.
|
|
144
|
+
*
|
|
145
|
+
* Fetches all messages and filters client-side. Pagination is handled automatically.
|
|
146
|
+
*
|
|
147
|
+
* @param options.pageSize - Messages fetched per API call (1–100). Defaults to 50.
|
|
148
|
+
* @param options.direction - Filter by `"inbound"` or `"outbound"`.
|
|
149
|
+
*/
|
|
150
|
+
async *iterUnreadEmails(options = {}) {
|
|
151
|
+
for await (const msg of this.iterEmails(options)) {
|
|
152
|
+
if (!msg.isRead)
|
|
153
|
+
yield msg;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Mark a list of messages as read.
|
|
158
|
+
*
|
|
159
|
+
* @param messageIds - IDs of the messages to mark as read.
|
|
160
|
+
*/
|
|
161
|
+
async markEmailsRead(messageIds) {
|
|
162
|
+
this._requireMailbox();
|
|
163
|
+
for (const id of messageIds) {
|
|
164
|
+
await this._inkbox._messages.markRead(this._mailbox.emailAddress, id);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Get a thread with all its messages inlined (oldest-first).
|
|
169
|
+
*
|
|
170
|
+
* @param threadId - UUID of the thread to fetch. Obtain via `msg.threadId`
|
|
171
|
+
* on any {@link Message}.
|
|
172
|
+
*/
|
|
173
|
+
async getThread(threadId) {
|
|
174
|
+
this._requireMailbox();
|
|
175
|
+
return this._inkbox._threads.get(this._mailbox.emailAddress, threadId);
|
|
176
|
+
}
|
|
177
|
+
// ------------------------------------------------------------------
|
|
178
|
+
// Phone helpers
|
|
179
|
+
// ------------------------------------------------------------------
|
|
180
|
+
/**
|
|
181
|
+
* Place an outbound call from this identity's phone number.
|
|
182
|
+
*
|
|
183
|
+
* @param options.toNumber - E.164 destination number.
|
|
184
|
+
* @param options.clientWebsocketUrl - WebSocket URL (wss://) for audio bridging.
|
|
185
|
+
* @param options.webhookUrl - Custom webhook URL for call lifecycle events.
|
|
186
|
+
*/
|
|
187
|
+
async placeCall(options) {
|
|
188
|
+
this._requirePhone();
|
|
189
|
+
return this._inkbox._calls.place({
|
|
190
|
+
fromNumber: this._phoneNumber.number,
|
|
191
|
+
toNumber: options.toNumber,
|
|
192
|
+
clientWebsocketUrl: options.clientWebsocketUrl,
|
|
193
|
+
webhookUrl: options.webhookUrl,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* List calls made to/from this identity's phone number.
|
|
198
|
+
*
|
|
199
|
+
* @param options.limit - Maximum number of results. Defaults to 50.
|
|
200
|
+
* @param options.offset - Pagination offset. Defaults to 0.
|
|
201
|
+
*/
|
|
202
|
+
async listCalls(options = {}) {
|
|
203
|
+
this._requirePhone();
|
|
204
|
+
return this._inkbox._calls.list(this._phoneNumber.id, options);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* List transcript segments for a specific call.
|
|
208
|
+
*
|
|
209
|
+
* @param callId - ID of the call to fetch transcripts for.
|
|
210
|
+
*/
|
|
211
|
+
async listTranscripts(callId) {
|
|
212
|
+
this._requirePhone();
|
|
213
|
+
return this._inkbox._transcripts.list(this._phoneNumber.id, callId);
|
|
214
|
+
}
|
|
215
|
+
// ------------------------------------------------------------------
|
|
216
|
+
// Identity management
|
|
217
|
+
// ------------------------------------------------------------------
|
|
218
|
+
/**
|
|
219
|
+
* Update this identity's handle or status.
|
|
220
|
+
*
|
|
221
|
+
* @param options.newHandle - New agent handle.
|
|
222
|
+
* @param options.status - New lifecycle status: `"active"` or `"paused"`.
|
|
223
|
+
*/
|
|
224
|
+
async update(options) {
|
|
225
|
+
const result = await this._inkbox._idsResource.update(this.agentHandle, options);
|
|
226
|
+
this._data = {
|
|
227
|
+
...result,
|
|
228
|
+
mailbox: this._mailbox,
|
|
229
|
+
phoneNumber: this._phoneNumber,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Re-fetch this identity from the API and update cached channels.
|
|
234
|
+
*
|
|
235
|
+
* @returns `this` for chaining.
|
|
236
|
+
*/
|
|
237
|
+
async refresh() {
|
|
238
|
+
const data = await this._inkbox._idsResource.get(this.agentHandle);
|
|
239
|
+
this._data = data;
|
|
240
|
+
this._mailbox = data.mailbox;
|
|
241
|
+
this._phoneNumber = data.phoneNumber;
|
|
242
|
+
return this;
|
|
243
|
+
}
|
|
244
|
+
/** Soft-delete this identity (unlinks channels without deleting them). */
|
|
245
|
+
async delete() {
|
|
246
|
+
await this._inkbox._idsResource.delete(this.agentHandle);
|
|
247
|
+
}
|
|
248
|
+
// ------------------------------------------------------------------
|
|
249
|
+
// Internal guards
|
|
250
|
+
// ------------------------------------------------------------------
|
|
251
|
+
_requireMailbox() {
|
|
252
|
+
if (!this._mailbox) {
|
|
253
|
+
throw new InkboxAPIError(0, `Identity '${this.agentHandle}' has no mailbox assigned. Call identity.createMailbox() or identity.assignMailbox() first.`);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
_requirePhone() {
|
|
257
|
+
if (!this._phoneNumber) {
|
|
258
|
+
throw new InkboxAPIError(0, `Identity '${this.agentHandle}' has no phone number assigned. Call identity.provisionPhoneNumber() or identity.assignPhoneNumber() first.`);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=agent_identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent_identity.js","sourceRoot":"","sources":["../src/agent_identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAW5C,MAAM,OAAO,aAAa;IAChB,KAAK,CAAqB;IACjB,OAAO,CAAS;IACzB,QAAQ,CAAyB;IACjC,YAAY,CAA6B;IAEjD,YAAY,IAAwB,EAAE,MAAc;QAClD,IAAI,CAAC,KAAK,GAAU,IAAI,CAAC;QACzB,IAAI,CAAC,OAAO,GAAQ,MAAM,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAO,IAAI,CAAC,OAAO,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC;IACvC,CAAC;IAED,qEAAqE;IACrE,sBAAsB;IACtB,qEAAqE;IAErE,IAAI,WAAW,KAAa,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IAC5D,IAAI,EAAE,KAAuB,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IACpD,IAAI,MAAM,KAAmB,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AC,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0EAA0E;IAC1E,KAAK,CAAC,MAAM;QACV,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC3D,CAAC;IAED,qEAAqE;IACrE,kBAAkB;IAClB,qEAAqE;IAE7D,eAAe;QACrB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,MAAM,IAAI,cAAc,CACtB,CAAC,EACD,aAAa,IAAI,CAAC,WAAW,6FAA6F,CAC3H,CAAC;QACJ,CAAC;IACH,CAAC;IAEO,aAAa;QACnB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,MAAM,IAAI,cAAc,CACtB,CAAC,EACD,aAAa,IAAI,CAAC,WAAW,6GAA6G,CAC3I,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inkbox-identities/resources/identities.ts
|
|
3
|
+
*
|
|
4
|
+
* Identity CRUD and channel assignment.
|
|
5
|
+
*/
|
|
6
|
+
import { HttpTransport } from "../../_http.js";
|
|
7
|
+
import { AgentIdentitySummary, _AgentIdentityData } from "../types.js";
|
|
8
|
+
export declare class IdentitiesResource {
|
|
9
|
+
private readonly http;
|
|
10
|
+
constructor(http: HttpTransport);
|
|
11
|
+
/**
|
|
12
|
+
* Create a new agent identity.
|
|
13
|
+
*
|
|
14
|
+
* @param options.agentHandle - Unique handle for this identity within your organisation
|
|
15
|
+
* (e.g. `"sales-agent"` or `"@sales-agent"`).
|
|
16
|
+
*/
|
|
17
|
+
create(options: {
|
|
18
|
+
agentHandle: string;
|
|
19
|
+
}): Promise<AgentIdentitySummary>;
|
|
20
|
+
/** List all identities for your organisation. */
|
|
21
|
+
list(): Promise<AgentIdentitySummary[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Get an identity with its linked channels (mailbox, phone number).
|
|
24
|
+
*
|
|
25
|
+
* @param agentHandle - Handle of the identity to fetch.
|
|
26
|
+
*/
|
|
27
|
+
get(agentHandle: string): Promise<_AgentIdentityData>;
|
|
28
|
+
/**
|
|
29
|
+
* Update an identity's handle or status.
|
|
30
|
+
*
|
|
31
|
+
* Only provided fields are applied; omitted fields are left unchanged.
|
|
32
|
+
*
|
|
33
|
+
* @param agentHandle - Current handle of the identity to update.
|
|
34
|
+
* @param options.newHandle - New handle value.
|
|
35
|
+
* @param options.status - New lifecycle status: `"active"` or `"paused"`.
|
|
36
|
+
*/
|
|
37
|
+
update(agentHandle: string, options: {
|
|
38
|
+
newHandle?: string;
|
|
39
|
+
status?: string;
|
|
40
|
+
}): Promise<AgentIdentitySummary>;
|
|
41
|
+
/**
|
|
42
|
+
* Soft-delete an identity.
|
|
43
|
+
*
|
|
44
|
+
* Unlinks any assigned channels without deleting them.
|
|
45
|
+
*
|
|
46
|
+
* @param agentHandle - Handle of the identity to delete.
|
|
47
|
+
*/
|
|
48
|
+
delete(agentHandle: string): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Assign a mailbox to an identity.
|
|
51
|
+
*
|
|
52
|
+
* @param agentHandle - Handle of the identity.
|
|
53
|
+
* @param options.mailboxId - UUID of the mailbox to assign.
|
|
54
|
+
*/
|
|
55
|
+
assignMailbox(agentHandle: string, options: {
|
|
56
|
+
mailboxId: string;
|
|
57
|
+
}): Promise<_AgentIdentityData>;
|
|
58
|
+
/**
|
|
59
|
+
* Unlink the mailbox from an identity (does not delete the mailbox).
|
|
60
|
+
*
|
|
61
|
+
* @param agentHandle - Handle of the identity.
|
|
62
|
+
*/
|
|
63
|
+
unlinkMailbox(agentHandle: string): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Assign a phone number to an identity.
|
|
66
|
+
*
|
|
67
|
+
* @param agentHandle - Handle of the identity.
|
|
68
|
+
* @param options.phoneNumberId - UUID of the phone number to assign.
|
|
69
|
+
*/
|
|
70
|
+
assignPhoneNumber(agentHandle: string, options: {
|
|
71
|
+
phoneNumberId: string;
|
|
72
|
+
}): Promise<_AgentIdentityData>;
|
|
73
|
+
/**
|
|
74
|
+
* Unlink the phone number from an identity (does not delete the number).
|
|
75
|
+
*
|
|
76
|
+
* @param agentHandle - Handle of the identity.
|
|
77
|
+
*/
|
|
78
|
+
unlinkPhoneNumber(agentHandle: string): Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=identities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identities.d.ts","sourceRoot":"","sources":["../../../src/identities/resources/identities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAKnB,MAAM,aAAa,CAAC;AAErB,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEhD;;;;;OAKG;IACG,MAAM,CAAC,OAAO,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAO7E,iDAAiD;IAC3C,IAAI,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAK7C;;;;OAIG;IACG,GAAG,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAK3D;;;;;;;;OAQG;IACG,MAAM,CACV,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAC/C,OAAO,CAAC,oBAAoB,CAAC;IAQhC;;;;;;OAMG;IACG,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhD;;;;;OAKG;IACG,aAAa,CACjB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAC7B,OAAO,CAAC,kBAAkB,CAAC;IAQ9B;;;;OAIG;IACG,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvD;;;;;OAKG;IACG,iBAAiB,CACrB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,GACjC,OAAO,CAAC,kBAAkB,CAAC;IAQ9B;;;;OAIG;IACG,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG5D"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inkbox-identities/resources/identities.ts
|
|
3
|
+
*
|
|
4
|
+
* Identity CRUD and channel assignment.
|
|
5
|
+
*/
|
|
6
|
+
import { parseAgentIdentitySummary, parseAgentIdentityData, } from "../types.js";
|
|
7
|
+
export class IdentitiesResource {
|
|
8
|
+
http;
|
|
9
|
+
constructor(http) {
|
|
10
|
+
this.http = http;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Create a new agent identity.
|
|
14
|
+
*
|
|
15
|
+
* @param options.agentHandle - Unique handle for this identity within your organisation
|
|
16
|
+
* (e.g. `"sales-agent"` or `"@sales-agent"`).
|
|
17
|
+
*/
|
|
18
|
+
async create(options) {
|
|
19
|
+
const data = await this.http.post("/", {
|
|
20
|
+
agent_handle: options.agentHandle,
|
|
21
|
+
});
|
|
22
|
+
return parseAgentIdentitySummary(data);
|
|
23
|
+
}
|
|
24
|
+
/** List all identities for your organisation. */
|
|
25
|
+
async list() {
|
|
26
|
+
const data = await this.http.get("/");
|
|
27
|
+
return data.map(parseAgentIdentitySummary);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get an identity with its linked channels (mailbox, phone number).
|
|
31
|
+
*
|
|
32
|
+
* @param agentHandle - Handle of the identity to fetch.
|
|
33
|
+
*/
|
|
34
|
+
async get(agentHandle) {
|
|
35
|
+
const data = await this.http.get(`/${agentHandle}`);
|
|
36
|
+
return parseAgentIdentityData(data);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Update an identity's handle or status.
|
|
40
|
+
*
|
|
41
|
+
* Only provided fields are applied; omitted fields are left unchanged.
|
|
42
|
+
*
|
|
43
|
+
* @param agentHandle - Current handle of the identity to update.
|
|
44
|
+
* @param options.newHandle - New handle value.
|
|
45
|
+
* @param options.status - New lifecycle status: `"active"` or `"paused"`.
|
|
46
|
+
*/
|
|
47
|
+
async update(agentHandle, options) {
|
|
48
|
+
const body = {};
|
|
49
|
+
if (options.newHandle !== undefined)
|
|
50
|
+
body["agent_handle"] = options.newHandle;
|
|
51
|
+
if (options.status !== undefined)
|
|
52
|
+
body["status"] = options.status;
|
|
53
|
+
const data = await this.http.patch(`/${agentHandle}`, body);
|
|
54
|
+
return parseAgentIdentitySummary(data);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Soft-delete an identity.
|
|
58
|
+
*
|
|
59
|
+
* Unlinks any assigned channels without deleting them.
|
|
60
|
+
*
|
|
61
|
+
* @param agentHandle - Handle of the identity to delete.
|
|
62
|
+
*/
|
|
63
|
+
async delete(agentHandle) {
|
|
64
|
+
await this.http.delete(`/${agentHandle}`);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Assign a mailbox to an identity.
|
|
68
|
+
*
|
|
69
|
+
* @param agentHandle - Handle of the identity.
|
|
70
|
+
* @param options.mailboxId - UUID of the mailbox to assign.
|
|
71
|
+
*/
|
|
72
|
+
async assignMailbox(agentHandle, options) {
|
|
73
|
+
const data = await this.http.post(`/${agentHandle}/mailbox`, { mailbox_id: options.mailboxId });
|
|
74
|
+
return parseAgentIdentityData(data);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Unlink the mailbox from an identity (does not delete the mailbox).
|
|
78
|
+
*
|
|
79
|
+
* @param agentHandle - Handle of the identity.
|
|
80
|
+
*/
|
|
81
|
+
async unlinkMailbox(agentHandle) {
|
|
82
|
+
await this.http.delete(`/${agentHandle}/mailbox`);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Assign a phone number to an identity.
|
|
86
|
+
*
|
|
87
|
+
* @param agentHandle - Handle of the identity.
|
|
88
|
+
* @param options.phoneNumberId - UUID of the phone number to assign.
|
|
89
|
+
*/
|
|
90
|
+
async assignPhoneNumber(agentHandle, options) {
|
|
91
|
+
const data = await this.http.post(`/${agentHandle}/phone_number`, { phone_number_id: options.phoneNumberId });
|
|
92
|
+
return parseAgentIdentityData(data);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Unlink the phone number from an identity (does not delete the number).
|
|
96
|
+
*
|
|
97
|
+
* @param agentHandle - Handle of the identity.
|
|
98
|
+
*/
|
|
99
|
+
async unlinkPhoneNumber(agentHandle) {
|
|
100
|
+
await this.http.delete(`/${agentHandle}/phone_number`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=identities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identities.js","sourceRoot":"","sources":["../../../src/identities/resources/identities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAKL,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAErB,MAAM,OAAO,kBAAkB;IACA;IAA7B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,OAAgC;QAC3C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAA0B,GAAG,EAAE;YAC9D,YAAY,EAAE,OAAO,CAAC,WAAW;SAClC,CAAC,CAAC;QACH,OAAO,yBAAyB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IA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QACF,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,aAAa,CAAC,WAAmB;QACrC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,WAAW,UAAU,CAAC,CAAC;IACpD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,iBAAiB,CACrB,WAAmB,EACnB,OAAkC;QAElC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAC/B,IAAI,WAAW,eAAe,EAC9B,EAAE,eAAe,EAAE,OAAO,CAAC,aAAa,EAAE,CAC3C,CAAC;QACF,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,iBAAiB,CAAC,WAAmB;QACzC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,WAAW,eAAe,CAAC,CAAC;IACzD,CAAC;CACF"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inkbox-identities TypeScript SDK — public types.
|
|
3
|
+
*/
|
|
4
|
+
export interface IdentityMailbox {
|
|
5
|
+
id: string;
|
|
6
|
+
emailAddress: string;
|
|
7
|
+
displayName: string | null;
|
|
8
|
+
/** "active" | "paused" | "deleted" */
|
|
9
|
+
status: string;
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
updatedAt: Date;
|
|
12
|
+
}
|
|
13
|
+
export interface IdentityPhoneNumber {
|
|
14
|
+
id: string;
|
|
15
|
+
number: string;
|
|
16
|
+
/** "toll_free" | "local" */
|
|
17
|
+
type: string;
|
|
18
|
+
/** "active" | "paused" | "released" */
|
|
19
|
+
status: string;
|
|
20
|
+
/** "auto_accept" | "auto_reject" | "webhook" */
|
|
21
|
+
incomingCallAction: string;
|
|
22
|
+
clientWebsocketUrl: string | null;
|
|
23
|
+
createdAt: Date;
|
|
24
|
+
updatedAt: Date;
|
|
25
|
+
}
|
|
26
|
+
/** Lightweight identity returned by list and update endpoints. */
|
|
27
|
+
export interface AgentIdentitySummary {
|
|
28
|
+
id: string;
|
|
29
|
+
organizationId: string;
|
|
30
|
+
agentHandle: string;
|
|
31
|
+
/** "active" | "paused" | "deleted" */
|
|
32
|
+
status: string;
|
|
33
|
+
createdAt: Date;
|
|
34
|
+
updatedAt: Date;
|
|
35
|
+
}
|
|
36
|
+
/** @internal Full identity data with channels — users interact with AgentIdentity (the class) instead. */
|
|
37
|
+
export interface _AgentIdentityData extends AgentIdentitySummary {
|
|
38
|
+
/** Mailbox assigned to this identity, or null if unlinked. */
|
|
39
|
+
mailbox: IdentityMailbox | null;
|
|
40
|
+
/** Phone number assigned to this identity, or null if unlinked. */
|
|
41
|
+
phoneNumber: IdentityPhoneNumber | null;
|
|
42
|
+
}
|
|
43
|
+
export interface RawIdentityMailbox {
|
|
44
|
+
id: string;
|
|
45
|
+
email_address: string;
|
|
46
|
+
display_name: string | null;
|
|
47
|
+
status: string;
|
|
48
|
+
created_at: string;
|
|
49
|
+
updated_at: string;
|
|
50
|
+
}
|
|
51
|
+
export interface RawIdentityPhoneNumber {
|
|
52
|
+
id: string;
|
|
53
|
+
number: string;
|
|
54
|
+
type: string;
|
|
55
|
+
status: string;
|
|
56
|
+
incoming_call_action: string;
|
|
57
|
+
client_websocket_url: string | null;
|
|
58
|
+
created_at: string;
|
|
59
|
+
updated_at: string;
|
|
60
|
+
}
|
|
61
|
+
export interface RawAgentIdentitySummary {
|
|
62
|
+
id: string;
|
|
63
|
+
organization_id: string;
|
|
64
|
+
agent_handle: string;
|
|
65
|
+
status: string;
|
|
66
|
+
created_at: string;
|
|
67
|
+
updated_at: string;
|
|
68
|
+
}
|
|
69
|
+
export interface RawAgentIdentityData extends RawAgentIdentitySummary {
|
|
70
|
+
mailbox: RawIdentityMailbox | null;
|
|
71
|
+
phone_number: RawIdentityPhoneNumber | null;
|
|
72
|
+
}
|
|
73
|
+
export declare function parseIdentityMailbox(r: RawIdentityMailbox): IdentityMailbox;
|
|
74
|
+
export declare function parseIdentityPhoneNumber(r: RawIdentityPhoneNumber): IdentityPhoneNumber;
|
|
75
|
+
export declare function parseAgentIdentitySummary(r: RawAgentIdentitySummary): AgentIdentitySummary;
|
|
76
|
+
export declare function parseAgentIdentityData(r: RawAgentIdentityData): _AgentIdentityData;
|
|
77
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/identities/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,kEAAkE;AAClE,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,0GAA0G;AAC1G,MAAM,WAAW,kBAAmB,SAAQ,oBAAoB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B,GAAG,kBAAkB,CAMlF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inkbox-identities TypeScript SDK — public types.
|
|
3
|
+
*/
|
|
4
|
+
// ---- parsers ----
|
|
5
|
+
export function parseIdentityMailbox(r) {
|
|
6
|
+
return {
|
|
7
|
+
id: r.id,
|
|
8
|
+
emailAddress: r.email_address,
|
|
9
|
+
displayName: r.display_name,
|
|
10
|
+
status: r.status,
|
|
11
|
+
createdAt: new Date(r.created_at),
|
|
12
|
+
updatedAt: new Date(r.updated_at),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function parseIdentityPhoneNumber(r) {
|
|
16
|
+
return {
|
|
17
|
+
id: r.id,
|
|
18
|
+
number: r.number,
|
|
19
|
+
type: r.type,
|
|
20
|
+
status: r.status,
|
|
21
|
+
incomingCallAction: r.incoming_call_action,
|
|
22
|
+
clientWebsocketUrl: r.client_websocket_url,
|
|
23
|
+
createdAt: new Date(r.created_at),
|
|
24
|
+
updatedAt: new Date(r.updated_at),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function parseAgentIdentitySummary(r) {
|
|
28
|
+
return {
|
|
29
|
+
id: r.id,
|
|
30
|
+
organizationId: r.organization_id,
|
|
31
|
+
agentHandle: r.agent_handle,
|
|
32
|
+
status: r.status,
|
|
33
|
+
createdAt: new Date(r.created_at),
|
|
34
|
+
updatedAt: new Date(r.updated_at),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export function parseAgentIdentityData(r) {
|
|
38
|
+
return {
|
|
39
|
+
...parseAgentIdentitySummary(r),
|
|
40
|
+
mailbox: r.mailbox ? parseIdentityMailbox(r.mailbox) : null,
|
|
41
|
+
phoneNumber: r.phone_number ? parseIdentityPhoneNumber(r.phone_number) : null,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.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,GAAG,yBAAyB,CAAC,CAAC,CAAC;QAC/B,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;QAC3D,WAAW,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI;KAC9E,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { Inkbox } from "./inkbox.js";
|
|
2
|
+
export { AgentIdentity } from "./agent_identity.js";
|
|
3
|
+
export type { InkboxOptions } from "./inkbox.js";
|
|
4
|
+
export { InkboxAPIError } from "./_http.js";
|
|
5
|
+
export type { SigningKey } from "./signing_keys.js";
|
|
6
|
+
export { verifyWebhook } from "./signing_keys.js";
|
|
7
|
+
export type { Mailbox, Message, MessageDetail, Thread, ThreadDetail, } from "./mail/types.js";
|
|
8
|
+
export type { PhoneNumber, PhoneCall, PhoneCallWithRateLimit, RateLimitInfo, PhoneTranscript, } from "./phone/types.js";
|
|
9
|
+
export type { AgentIdentitySummary, IdentityMailbox, IdentityPhoneNumber, } from "./identities/types.js";
|
|
10
|
+
//# 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,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,YAAY,EACV,OAAO,EACP,OAAO,EACP,aAAa,EACb,MAAM,EACN,YAAY,GACb,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,WAAW,EACX,SAAS,EACT,sBAAsB,EACtB,aAAa,EACb,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,mBAAmB,GACpB,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
|