@ixblix/sdk-js 0.2.2 → 0.2.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/README.md +58 -0
- package/dist/client.d.ts +22 -4
- package/dist/client.js +24 -3
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +29 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,6 +53,14 @@ const { conversation, deeplink } = await ixblix.createConversation({
|
|
|
53
53
|
},
|
|
54
54
|
channel: "whatsapp",
|
|
55
55
|
operatorPublicKey: operatorKey.publicKeySpki,
|
|
56
|
+
// Optionally attach the operator's identity so the customer's client can
|
|
57
|
+
// display who is handling the conversation (avatar, name, gravatar).
|
|
58
|
+
operator: {
|
|
59
|
+
uuid: "agent-42",
|
|
60
|
+
name: "Maria Silva",
|
|
61
|
+
image: "https://cdn.example.com/avatars/maria.png",
|
|
62
|
+
// or gravatarHash: md5("maria@example.com")
|
|
63
|
+
},
|
|
56
64
|
});
|
|
57
65
|
|
|
58
66
|
// 4. Share `deeplink` with the contact. When they open it, their browser
|
|
@@ -86,6 +94,56 @@ for (const message of messages) {
|
|
|
86
94
|
}
|
|
87
95
|
```
|
|
88
96
|
|
|
97
|
+
## Operator identity
|
|
98
|
+
|
|
99
|
+
You can attach the identity of the desk/CRM agent (operator) handling a
|
|
100
|
+
conversation so the customer's client can display who is talking to them. The
|
|
101
|
+
operator is described by a stable `uuid`, a display `name`, and either an
|
|
102
|
+
`image` URL or a `gravatarHash` (MD5 of the operator's email).
|
|
103
|
+
|
|
104
|
+
Attach the operator when creating the conversation:
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
const { conversation } = await ixblix.createConversation({
|
|
108
|
+
contact: { externalId: "whatsapp_5511999999999", name: "John Doe" },
|
|
109
|
+
channel: "whatsapp",
|
|
110
|
+
operatorPublicKey: operatorKey.publicKeySpki,
|
|
111
|
+
operator: {
|
|
112
|
+
uuid: "agent-42",
|
|
113
|
+
name: "Maria Silva",
|
|
114
|
+
gravatarHash: "5d41402abc4b2a76b9719d911017c592",
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Update the operator at any moment during the conversation. Only the provided
|
|
120
|
+
fields are updated; omitted fields keep their current value. Pass `null` to
|
|
121
|
+
clear a field:
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
await ixblix.updateOperator(conversation.id, {
|
|
125
|
+
name: "Maria S. (Supervisor)",
|
|
126
|
+
image: "https://cdn.example.com/avatars/maria-v2.png",
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Every company-sent message is attributed to the conversation's operator. You
|
|
131
|
+
can also pass the operator uuid explicitly when sending a message or media so
|
|
132
|
+
the message is attributed to a specific agent:
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
await ixblix.sendCompanyMessage(
|
|
136
|
+
conversation.id,
|
|
137
|
+
envelope,
|
|
138
|
+
"text",
|
|
139
|
+
"agent-42", // operator uuid
|
|
140
|
+
);
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The returned `Message` objects include an `operatorUuid` field on
|
|
144
|
+
company-sent messages, and the conversation payloads include the full
|
|
145
|
+
`operator` object so the customer's client can render the avatar.
|
|
146
|
+
|
|
89
147
|
## Company onboarding
|
|
90
148
|
|
|
91
149
|
Register a company (keyless), then activate it after payment to obtain the API
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActivateCompanyResult, CompanyBalance, CompanyCustomization, CompanyCustomizationInput, CompanyProfile, ContactInput, ConversationKeys, CreateConversationResult, CreditPurchase, Media, Message, MessageEnvelope, OriginalChannelMessageInput, PaymentProvidersResult, Plan, PurchaseCreditsResult, RegisterCompanyInput, RegisterCompanyResult } from "./types.js";
|
|
1
|
+
import type { ActivateCompanyResult, CompanyBalance, CompanyCustomization, CompanyCustomizationInput, CompanyProfile, ContactInput, ConversationKeys, CreateConversationResult, CreditPurchase, Media, Message, MessageEnvelope, OperatorInput, OriginalChannelMessageInput, PaymentProvidersResult, Plan, PurchaseCreditsResult, RegisterCompanyInput, RegisterCompanyResult, UpdateOperatorResult } from "./types.js";
|
|
2
2
|
/** Options for constructing an {@link IxblixClient}. */
|
|
3
3
|
export interface IxblixClientOptions {
|
|
4
4
|
/** Base URL of the ixblix API, e.g. `https://api.ixblix.app`. */
|
|
@@ -109,12 +109,28 @@ export declare class IxblixClient {
|
|
|
109
109
|
/**
|
|
110
110
|
* Create an overflow conversation for a contact. Supply the operator's RSA
|
|
111
111
|
* public key (base64 SPKI DER) so the customer can encrypt messages to it.
|
|
112
|
+
* Optionally attach the operator's identity (uuid, name, image and/or
|
|
113
|
+
* gravatar hash) so the customer's client can display who is handling the
|
|
114
|
+
* conversation.
|
|
112
115
|
*/
|
|
113
116
|
createConversation(input: {
|
|
114
117
|
contact: ContactInput;
|
|
115
118
|
channel: string;
|
|
116
119
|
operatorPublicKey: string;
|
|
120
|
+
operator?: {
|
|
121
|
+
uuid?: string;
|
|
122
|
+
name?: string;
|
|
123
|
+
image?: string;
|
|
124
|
+
gravatarHash?: string;
|
|
125
|
+
};
|
|
117
126
|
}): Promise<CreateConversationResult>;
|
|
127
|
+
/**
|
|
128
|
+
* Update the operator identity (uuid, name, image and/or gravatar hash)
|
|
129
|
+
* attached to a conversation. Only the provided fields are updated; omitted
|
|
130
|
+
* fields keep their current value. Pass `null` to clear a field. The
|
|
131
|
+
* operator can be updated at any moment during the conversation.
|
|
132
|
+
*/
|
|
133
|
+
updateOperator(conversationId: string, operator: OperatorInput): Promise<UpdateOperatorResult>;
|
|
118
134
|
/**
|
|
119
135
|
* Fetch the current E2EE key state of a conversation so the operator can
|
|
120
136
|
* detect when the customer has joined (`keyStatus === "ACTIVE"`).
|
|
@@ -123,8 +139,9 @@ export declare class IxblixClient {
|
|
|
123
139
|
/**
|
|
124
140
|
* Send an encrypted message from the company to the contact. The message must
|
|
125
141
|
* already be encrypted to the customer's public key (see the crypto helpers).
|
|
142
|
+
* Optionally pass the operator uuid so it is attributed to the message.
|
|
126
143
|
*/
|
|
127
|
-
sendCompanyMessage(conversationId: string, envelope: MessageEnvelope, contentType?: string): Promise<Message>;
|
|
144
|
+
sendCompanyMessage(conversationId: string, envelope: MessageEnvelope, contentType?: string, operatorUuid?: string): Promise<Message>;
|
|
128
145
|
/** List all messages of a conversation (content is always ciphertext). */
|
|
129
146
|
listMessages(conversationId: string): Promise<Message[]>;
|
|
130
147
|
/**
|
|
@@ -150,9 +167,10 @@ export declare class IxblixClient {
|
|
|
150
167
|
relayOriginalChannelMessage(input: OriginalChannelMessageInput): Promise<Message>;
|
|
151
168
|
/**
|
|
152
169
|
* Upload an encrypted media file from the company. `file.data` must be the
|
|
153
|
-
* ciphertext bytes produced by the media encryption helper.
|
|
170
|
+
* ciphertext bytes produced by the media encryption helper. Optionally pass
|
|
171
|
+
* the operator uuid so the media message is attributed to the operator.
|
|
154
172
|
*/
|
|
155
|
-
sendCompanyMedia(conversationId: string, file: MediaUpload, envelope: MessageEnvelope): Promise<Message>;
|
|
173
|
+
sendCompanyMedia(conversationId: string, file: MediaUpload, envelope: MessageEnvelope, operatorUuid?: string): Promise<Message>;
|
|
156
174
|
/** Fetch the metadata (envelope + file info) of a media file. */
|
|
157
175
|
getMedia(mediaId: string): Promise<Media>;
|
|
158
176
|
/**
|
package/dist/client.js
CHANGED
|
@@ -174,6 +174,9 @@ export class IxblixClient {
|
|
|
174
174
|
/**
|
|
175
175
|
* Create an overflow conversation for a contact. Supply the operator's RSA
|
|
176
176
|
* public key (base64 SPKI DER) so the customer can encrypt messages to it.
|
|
177
|
+
* Optionally attach the operator's identity (uuid, name, image and/or
|
|
178
|
+
* gravatar hash) so the customer's client can display who is handling the
|
|
179
|
+
* conversation.
|
|
177
180
|
*/
|
|
178
181
|
createConversation(input) {
|
|
179
182
|
return this.request("/api/conversations", {
|
|
@@ -181,6 +184,18 @@ export class IxblixClient {
|
|
|
181
184
|
body: JSON.stringify(input),
|
|
182
185
|
});
|
|
183
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Update the operator identity (uuid, name, image and/or gravatar hash)
|
|
189
|
+
* attached to a conversation. Only the provided fields are updated; omitted
|
|
190
|
+
* fields keep their current value. Pass `null` to clear a field. The
|
|
191
|
+
* operator can be updated at any moment during the conversation.
|
|
192
|
+
*/
|
|
193
|
+
updateOperator(conversationId, operator) {
|
|
194
|
+
return this.request(`/api/conversations/${conversationId}/operator`, {
|
|
195
|
+
method: "PUT",
|
|
196
|
+
body: JSON.stringify({ operator }),
|
|
197
|
+
});
|
|
198
|
+
}
|
|
184
199
|
/**
|
|
185
200
|
* Fetch the current E2EE key state of a conversation so the operator can
|
|
186
201
|
* detect when the customer has joined (`keyStatus === "ACTIVE"`).
|
|
@@ -194,8 +209,9 @@ export class IxblixClient {
|
|
|
194
209
|
/**
|
|
195
210
|
* Send an encrypted message from the company to the contact. The message must
|
|
196
211
|
* already be encrypted to the customer's public key (see the crypto helpers).
|
|
212
|
+
* Optionally pass the operator uuid so it is attributed to the message.
|
|
197
213
|
*/
|
|
198
|
-
sendCompanyMessage(conversationId, envelope, contentType = "text") {
|
|
214
|
+
sendCompanyMessage(conversationId, envelope, contentType = "text", operatorUuid) {
|
|
199
215
|
return this.request("/api/messages/company", {
|
|
200
216
|
method: "POST",
|
|
201
217
|
body: JSON.stringify({
|
|
@@ -207,6 +223,7 @@ export class IxblixClient {
|
|
|
207
223
|
encryptedKey: envelope.encryptedKey,
|
|
208
224
|
selfEncryptedKey: envelope.selfEncryptedKey,
|
|
209
225
|
keyId: envelope.keyId,
|
|
226
|
+
operatorUuid,
|
|
210
227
|
}),
|
|
211
228
|
});
|
|
212
229
|
}
|
|
@@ -250,9 +267,10 @@ export class IxblixClient {
|
|
|
250
267
|
// ---------------------------------------------------------------------------
|
|
251
268
|
/**
|
|
252
269
|
* Upload an encrypted media file from the company. `file.data` must be the
|
|
253
|
-
* ciphertext bytes produced by the media encryption helper.
|
|
270
|
+
* ciphertext bytes produced by the media encryption helper. Optionally pass
|
|
271
|
+
* the operator uuid so the media message is attributed to the operator.
|
|
254
272
|
*/
|
|
255
|
-
async sendCompanyMedia(conversationId, file, envelope) {
|
|
273
|
+
async sendCompanyMedia(conversationId, file, envelope, operatorUuid) {
|
|
256
274
|
const form = new FormData();
|
|
257
275
|
form.append("conversationId", conversationId);
|
|
258
276
|
form.append("file", new Blob([file.data], { type: file.mimeType }), file.fileName);
|
|
@@ -261,6 +279,9 @@ export class IxblixClient {
|
|
|
261
279
|
form.append("encryptedKey", envelope.encryptedKey);
|
|
262
280
|
form.append("selfEncryptedKey", envelope.selfEncryptedKey);
|
|
263
281
|
form.append("keyId", envelope.keyId);
|
|
282
|
+
if (operatorUuid) {
|
|
283
|
+
form.append("operatorUuid", operatorUuid);
|
|
284
|
+
}
|
|
264
285
|
const headers = {};
|
|
265
286
|
if (this.apiKey) {
|
|
266
287
|
headers["X-API-Key"] = this.apiKey;
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA0D1C;;;;;;;;;GASG;AACH,MAAM,OAAO,YAAY;IACN,OAAO,CAAS;IAChB,MAAM,CAAU;IAChB,SAAS,CAAe;IAEzC,YAAY,OAA4B;QACtC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI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D;gBACE,MAAM,EAAE,QAAQ,CAAC,MAAM;aACxB,CACF,CAAC;QACJ,CAAC;QACD,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC;QACjD,OAAO,EAAE,IAAI,EAAE,IAAI,UAAU,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC;IACtD,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -22,4 +22,4 @@ export { loadOrCreateOperatorKey } from "./keypair.js";
|
|
|
22
22
|
export { parseWebhook, verifyWebhook } from "./webhooks.js";
|
|
23
23
|
export type { ParsedWebhook } from "./webhooks.js";
|
|
24
24
|
export { WEBHOOK_SIGNATURE_HEADER, WEBHOOK_ID_HEADER, WEBHOOK_EVENT_HEADER, } from "./webhooks.js";
|
|
25
|
-
export type { SenderType, ConversationKeyStatus, ConversationStatus, ConsentStatus, Contact, ContactInput, Conversation, CompanyCustomization, CompanyCustomizationInput, CompanySummary, CompanyProfile, CreateConversationResult, ConversationKeys, RegisterCustomerKeyResult, EraseConversationResult, MessageEnvelope, Message, Media, Plan, RegisterCompanyInput, PaymentInstructions, RegisterCompanyResult, ActivateCompanyResult, CompanyBalance, CreditPurchase, PurchaseCreditsResult, PaymentProvidersResult, OriginalChannelMessageInput, WebhookEvent, CompanyActivatedEvent, MessageReceivedEvent, MessageReadEvent, CustomerJoinedEvent, ConversationClosedEvent, PresenceEvent, BalanceLowEvent, IxblixErrorBody, } from "./types.js";
|
|
25
|
+
export type { SenderType, ConversationKeyStatus, ConversationStatus, ConsentStatus, Contact, ContactInput, Conversation, CompanyCustomization, CompanyCustomizationInput, CompanySummary, CompanyProfile, CreateConversationResult, ConversationKeys, RegisterCustomerKeyResult, EraseConversationResult, Operator, OperatorInput, UpdateOperatorResult, MessageEnvelope, Message, Media, Plan, RegisterCompanyInput, PaymentInstructions, RegisterCompanyResult, ActivateCompanyResult, CompanyBalance, CreditPurchase, PurchaseCreditsResult, PaymentProvidersResult, OriginalChannelMessageInput, WebhookEvent, CompanyActivatedEvent, MessageReceivedEvent, MessageReadEvent, CustomerJoinedEvent, ConversationClosedEvent, PresenceEvent, BalanceLowEvent, IxblixErrorBody, } from "./types.js";
|
package/dist/types.d.ts
CHANGED
|
@@ -79,6 +79,28 @@ export interface CompanySummary {
|
|
|
79
79
|
name: string;
|
|
80
80
|
customizations?: CompanyCustomization;
|
|
81
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Identity of the desk/CRM agent (operator) handling a conversation. The
|
|
84
|
+
* operator can be attached when the conversation is created and updated at any
|
|
85
|
+
* time via the company API.
|
|
86
|
+
*/
|
|
87
|
+
export interface Operator {
|
|
88
|
+
/** Stable identifier of the operator in the desk/CRM. */
|
|
89
|
+
uuid?: string;
|
|
90
|
+
/** Display name of the operator. */
|
|
91
|
+
name?: string;
|
|
92
|
+
/** URL of the operator's avatar image. */
|
|
93
|
+
image?: string;
|
|
94
|
+
/** MD5 hash of the operator's email, used to build a Gravatar URL. */
|
|
95
|
+
gravatarHash?: string;
|
|
96
|
+
}
|
|
97
|
+
/** Payload used to attach/update an operator on a conversation. */
|
|
98
|
+
export interface OperatorInput {
|
|
99
|
+
uuid?: string | null;
|
|
100
|
+
name?: string | null;
|
|
101
|
+
image?: string | null;
|
|
102
|
+
gravatarHash?: string | null;
|
|
103
|
+
}
|
|
82
104
|
/** Result of creating a conversation. */
|
|
83
105
|
export interface CreateConversationResult {
|
|
84
106
|
conversation: Conversation;
|
|
@@ -86,6 +108,11 @@ export interface CreateConversationResult {
|
|
|
86
108
|
/** URL to share with the contact so they can join the secure chat. */
|
|
87
109
|
deeplink: string;
|
|
88
110
|
company: CompanySummary;
|
|
111
|
+
operator?: Operator;
|
|
112
|
+
}
|
|
113
|
+
/** Result of updating a conversation's operator. */
|
|
114
|
+
export interface UpdateOperatorResult {
|
|
115
|
+
operator: Operator;
|
|
89
116
|
}
|
|
90
117
|
/** Current E2EE key state of a conversation (operator view). */
|
|
91
118
|
export interface ConversationKeys {
|
|
@@ -146,6 +173,8 @@ export interface Message {
|
|
|
146
173
|
/** Present when the message carries an attached media file. */
|
|
147
174
|
mediaId?: string;
|
|
148
175
|
media?: Media;
|
|
176
|
+
/** Identifier of the operator that sent this message (COMPANY-sent only). */
|
|
177
|
+
operatorUuid?: string;
|
|
149
178
|
sentAt: string;
|
|
150
179
|
}
|
|
151
180
|
/** Metadata of a media file attached to a message. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ixblix/sdk-js",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Official ixblix SDK for desk/CRM integrations. Create overflow conversations, exchange end-to-end encrypted messages and media, and manage company onboarding.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|