@aui.io/aui-client 1.2.39 → 1.2.41
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 +116 -5
- package/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/types/TaskParameter.d.ts +1 -0
- package/dist/cjs/api/types/TraceEntity.d.ts +4 -1
- package/dist/cjs/api/types/TraceReferencedEntity.d.ts +4 -1
- package/dist/cjs/api/types/TraceSelfReviewEntity.d.ts +4 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/types/TaskParameter.d.mts +1 -0
- package/dist/esm/api/types/TraceEntity.d.mts +4 -1
- package/dist/esm/api/types/TraceReferencedEntity.d.mts +4 -1
- package/dist/esm/api/types/TraceSelfReviewEntity.d.mts +4 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -274,7 +274,8 @@ const messageResponse = await client.controllerApi.sendMessage({
|
|
|
274
274
|
task_id: string, // Task identifier
|
|
275
275
|
text?: string, // Message text (optional in v1.2.36+)
|
|
276
276
|
is_external_api?: boolean, // Optional: mark as external API call
|
|
277
|
-
|
|
277
|
+
include_business_trace?: boolean, // Optional: include NLU/understanding + business decisions in trace_info (NEW in v1.2.37; replaces include_trace_info)
|
|
278
|
+
include_context_trace?: boolean, // Optional: include context section + call_integration decisions in trace_info (NEW in v1.2.37; replaces include_trace_info)
|
|
278
279
|
context?: { // Optional: additional context
|
|
279
280
|
url?: string,
|
|
280
281
|
lead_details?: Record<string, any>,
|
|
@@ -339,12 +340,14 @@ const traceInfo = await client.controllerApi.getTraceInfo('your-task-id', 'your-
|
|
|
339
340
|
**Example:**
|
|
340
341
|
|
|
341
342
|
```typescript
|
|
342
|
-
// First, send a message with trace info enabled
|
|
343
|
+
// First, send a message with trace info enabled.
|
|
344
|
+
// Note: `include_trace_info` was replaced in v1.2.39 by two granular flags.
|
|
343
345
|
const message = await client.controllerApi.sendMessage({
|
|
344
346
|
task_id: 'your-task-id',
|
|
345
347
|
text: 'What products do you recommend?',
|
|
346
348
|
is_external_api: true,
|
|
347
|
-
|
|
349
|
+
include_business_trace: true,
|
|
350
|
+
include_context_trace: true
|
|
348
351
|
});
|
|
349
352
|
|
|
350
353
|
// Then retrieve the full trace info for that message
|
|
@@ -383,6 +386,53 @@ response.suggestions?.forEach((suggestion, index) => {
|
|
|
383
386
|
});
|
|
384
387
|
```
|
|
385
388
|
|
|
389
|
+
#### `startTextConversation(request)` - Start Text Conversation (NEW)
|
|
390
|
+
Start a phone-channel conversation (SMS or WhatsApp) with an initial outbound message.
|
|
391
|
+
|
|
392
|
+
The SDK creates a task on the AUI backend and then proxies to the `third-party-auth` service so the first message is delivered to the recipient over the chosen channel. Subsequent inbound replies from the user feed back into the same task and can be observed via the standard message / WebSocket APIs.
|
|
393
|
+
|
|
394
|
+
```typescript
|
|
395
|
+
const response = await client.controllerApi.startTextConversation({
|
|
396
|
+
phoneNumber: string, // Recipient phone number in E.164 format (e.g., '+19999999999')
|
|
397
|
+
channel: 'sms' | 'whatsapp',// Outbound channel
|
|
398
|
+
message?: string // Optional initial message to send (e.g., 'Hello!')
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
// Returns: TextConversationInitiateResponse
|
|
402
|
+
// {
|
|
403
|
+
// status: boolean, // true on success
|
|
404
|
+
// data: Record<string, string>, // backend payload (e.g., task / message identifiers)
|
|
405
|
+
// message: string, // human-readable status message
|
|
406
|
+
// statusCode: number // HTTP-style status code
|
|
407
|
+
// }
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
**Parameters:**
|
|
411
|
+
|
|
412
|
+
- `phoneNumber` *(required)* — Must include the country code in E.164 format. Example: `+15551234567`. Numbers without a country code are rejected by the upstream third-party-auth service.
|
|
413
|
+
- `channel` *(required)* — Either `'sms'` or `'whatsapp'`. Determines which provider sends the initial message.
|
|
414
|
+
- `message` *(optional)* — The first outbound message body. If omitted, the conversation is created but no initial message is sent.
|
|
415
|
+
|
|
416
|
+
**Example:**
|
|
417
|
+
|
|
418
|
+
```typescript
|
|
419
|
+
const response = await client.controllerApi.startTextConversation({
|
|
420
|
+
phoneNumber: '+19999999999',
|
|
421
|
+
channel: 'sms',
|
|
422
|
+
message: 'Hello!'
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
console.log('Status: ', response.status); // true
|
|
426
|
+
console.log('Status Code:', response.statusCode); // e.g. 200
|
|
427
|
+
console.log('Message: ', response.message); // e.g. 'Conversation initiated'
|
|
428
|
+
console.log('Data: ', response.data); // e.g. { task_id: '...', ... }
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
> ℹ️ **Tip:** During development you can default to a sandbox number with an env var, e.g.
|
|
432
|
+
> `phoneNumber: process.env.TEST_PHONE_NUMBER ?? '+15551234567'`. The placeholder
|
|
433
|
+
> `+15551234567` is rejected by the upstream provider — use a real, reachable E.164
|
|
434
|
+
> number to validate end-to-end delivery.
|
|
435
|
+
|
|
386
436
|
---
|
|
387
437
|
|
|
388
438
|
### WebSocket API
|
|
@@ -643,12 +693,14 @@ const client = new ApolloClient({
|
|
|
643
693
|
|
|
644
694
|
async function debugAgentResponse(taskId: string) {
|
|
645
695
|
try {
|
|
646
|
-
// Send a message with trace info enabled
|
|
696
|
+
// Send a message with trace info enabled.
|
|
697
|
+
// `include_trace_info` was replaced with the two flags below in v1.2.37.
|
|
647
698
|
const message = await client.controllerApi.sendMessage({
|
|
648
699
|
task_id: taskId,
|
|
649
700
|
text: 'What products do you recommend?',
|
|
650
701
|
is_external_api: true,
|
|
651
|
-
|
|
702
|
+
include_business_trace: true,
|
|
703
|
+
include_context_trace: true
|
|
652
704
|
});
|
|
653
705
|
|
|
654
706
|
console.log('Agent Response:', message.text);
|
|
@@ -707,6 +759,63 @@ getSuggestedQuestions('task-123', 'user-456');
|
|
|
707
759
|
// 3. "Can I schedule a test drive?"
|
|
708
760
|
```
|
|
709
761
|
|
|
762
|
+
### Start a Text Conversation - SMS / WhatsApp (NEW)
|
|
763
|
+
|
|
764
|
+
Reach a user over their phone channel (SMS or WhatsApp) with an initial outbound message. Internally, the SDK creates a task and dispatches the first message through Apollo's `third-party-auth` service — replies from the user thread back into the same task so you can keep using the existing message APIs and WebSocket events.
|
|
765
|
+
|
|
766
|
+
```typescript
|
|
767
|
+
import { ApolloClient, Apollo } from '@aui.io/aui-client';
|
|
768
|
+
|
|
769
|
+
const client = new ApolloClient({
|
|
770
|
+
networkApiKey: 'API_KEY_YOUR_KEY_HERE'
|
|
771
|
+
});
|
|
772
|
+
|
|
773
|
+
async function startTextConversation(
|
|
774
|
+
phoneNumber: string,
|
|
775
|
+
channel: 'sms' | 'whatsapp',
|
|
776
|
+
message: string
|
|
777
|
+
) {
|
|
778
|
+
try {
|
|
779
|
+
const response: Apollo.TextConversationInitiateResponse =
|
|
780
|
+
await client.controllerApi.startTextConversation({
|
|
781
|
+
phoneNumber, // E.164 format, e.g. '+19999999999'
|
|
782
|
+
channel, // 'sms' or 'whatsapp'
|
|
783
|
+
message // initial message body, e.g. 'Hello!'
|
|
784
|
+
});
|
|
785
|
+
|
|
786
|
+
console.log('✅ Conversation initiated');
|
|
787
|
+
console.log(' Status: ', response.status);
|
|
788
|
+
console.log(' Status Code:', response.statusCode);
|
|
789
|
+
console.log(' Message: ', response.message);
|
|
790
|
+
console.log(' Data: ', response.data);
|
|
791
|
+
|
|
792
|
+
return response;
|
|
793
|
+
} catch (error: any) {
|
|
794
|
+
console.error('❌ Error starting text conversation:', error.message);
|
|
795
|
+
if (error.body) {
|
|
796
|
+
console.error(' Body:', error.body);
|
|
797
|
+
}
|
|
798
|
+
throw error;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
// SMS
|
|
803
|
+
startTextConversation('+19999999999', 'sms', 'Hello!');
|
|
804
|
+
|
|
805
|
+
// WhatsApp
|
|
806
|
+
startTextConversation('+971501234567', 'whatsapp', 'Hi from AUI!');
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
**UI mapping:** This is the API behind the "Start Text Conversation" panel — phone number + channel selector (SMS / WhatsApp) + initial message — wired directly to `client.controllerApi.startTextConversation({ phoneNumber, channel, message })`.
|
|
810
|
+
|
|
811
|
+
**Common errors:**
|
|
812
|
+
|
|
813
|
+
| Symptom | Likely cause | Fix |
|
|
814
|
+
|---------|--------------|-----|
|
|
815
|
+
| `500` from upstream `third-party-auth` | Invalid or unreachable phone number (e.g., placeholder `+15551234567`) | Use a real E.164 number, including the country code |
|
|
816
|
+
| `422 Unprocessable Entity` | `phoneNumber` or `channel` missing / wrong shape | Ensure `channel` is exactly `'sms'` or `'whatsapp'` and `phoneNumber` starts with `+` |
|
|
817
|
+
| `401 / 403` | Missing or invalid `networkApiKey` | Pass `networkApiKey` to `ApolloClient` (or the `x-network-api-key` header) |
|
|
818
|
+
|
|
710
819
|
## 🔧 Advanced Configuration
|
|
711
820
|
|
|
712
821
|
### Custom Timeout and Retries
|
|
@@ -788,6 +897,7 @@ import {
|
|
|
788
897
|
CreateExternalTaskRequest,
|
|
789
898
|
SubmitExternalMessageRequest,
|
|
790
899
|
UserMessagePayload,
|
|
900
|
+
TextConversationInitiateRequest,
|
|
791
901
|
// Response types
|
|
792
902
|
CreateExternalTaskResponse,
|
|
793
903
|
ExternalTaskMessage,
|
|
@@ -795,6 +905,7 @@ import {
|
|
|
795
905
|
StreamingUpdatePayload,
|
|
796
906
|
FinalMessagePayload,
|
|
797
907
|
ErrorMessagePayload,
|
|
908
|
+
TextConversationInitiateResponse,
|
|
798
909
|
// Error types
|
|
799
910
|
ApolloError,
|
|
800
911
|
UnprocessableEntityError
|
package/dist/cjs/Client.js
CHANGED
|
@@ -45,8 +45,8 @@ class ApolloClient {
|
|
|
45
45
|
"x-network-api-key": _options === null || _options === void 0 ? void 0 : _options.networkApiKey,
|
|
46
46
|
"X-Fern-Language": "JavaScript",
|
|
47
47
|
"X-Fern-SDK-Name": "@aui.io/aui-client",
|
|
48
|
-
"X-Fern-SDK-Version": "1.2.
|
|
49
|
-
"User-Agent": "@aui.io/aui-client/1.2.
|
|
48
|
+
"X-Fern-SDK-Version": "1.2.41",
|
|
49
|
+
"User-Agent": "@aui.io/aui-client/1.2.41",
|
|
50
50
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
51
51
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
52
52
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type * as Apollo from "../index.js";
|
|
2
2
|
export interface TraceEntity {
|
|
3
3
|
entity: string;
|
|
4
|
-
identifier?:
|
|
4
|
+
identifier?: TraceEntity.Identifier;
|
|
5
5
|
reference?: string;
|
|
6
6
|
source: Apollo.TraceEntitySource;
|
|
7
7
|
params?: Record<string, unknown>;
|
|
8
8
|
sub_entities?: Apollo.TraceSubEntity[];
|
|
9
9
|
}
|
|
10
|
+
export declare namespace TraceEntity {
|
|
11
|
+
type Identifier = string | number;
|
|
12
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export interface TraceReferencedEntity {
|
|
2
2
|
entity: string;
|
|
3
|
-
identifier?:
|
|
3
|
+
identifier?: TraceReferencedEntity.Identifier;
|
|
4
4
|
reference?: string;
|
|
5
5
|
is_visible: boolean;
|
|
6
6
|
}
|
|
7
|
+
export declare namespace TraceReferencedEntity {
|
|
8
|
+
type Identifier = string | number;
|
|
9
|
+
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type * as Apollo from "../index.js";
|
|
2
2
|
export interface TraceSelfReviewEntity {
|
|
3
3
|
entity: string;
|
|
4
|
-
identifier?:
|
|
4
|
+
identifier?: TraceSelfReviewEntity.Identifier;
|
|
5
5
|
reference?: string;
|
|
6
6
|
sub_entities?: Apollo.TracSelfReviewSubEntity[];
|
|
7
7
|
self_review?: Apollo.TraceSelfReviewSection;
|
|
8
8
|
is_visible: boolean;
|
|
9
9
|
}
|
|
10
|
+
export declare namespace TraceSelfReviewEntity {
|
|
11
|
+
type Identifier = string | number;
|
|
12
|
+
}
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.2.
|
|
1
|
+
export declare const SDK_VERSION = "1.2.41";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.mjs
CHANGED
|
@@ -9,8 +9,8 @@ export class ApolloClient {
|
|
|
9
9
|
"x-network-api-key": _options === null || _options === void 0 ? void 0 : _options.networkApiKey,
|
|
10
10
|
"X-Fern-Language": "JavaScript",
|
|
11
11
|
"X-Fern-SDK-Name": "@aui.io/aui-client",
|
|
12
|
-
"X-Fern-SDK-Version": "1.2.
|
|
13
|
-
"User-Agent": "@aui.io/aui-client/1.2.
|
|
12
|
+
"X-Fern-SDK-Version": "1.2.41",
|
|
13
|
+
"User-Agent": "@aui.io/aui-client/1.2.41",
|
|
14
14
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
15
15
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
16
16
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type * as Apollo from "../index.mjs";
|
|
2
2
|
export interface TraceEntity {
|
|
3
3
|
entity: string;
|
|
4
|
-
identifier?:
|
|
4
|
+
identifier?: TraceEntity.Identifier;
|
|
5
5
|
reference?: string;
|
|
6
6
|
source: Apollo.TraceEntitySource;
|
|
7
7
|
params?: Record<string, unknown>;
|
|
8
8
|
sub_entities?: Apollo.TraceSubEntity[];
|
|
9
9
|
}
|
|
10
|
+
export declare namespace TraceEntity {
|
|
11
|
+
type Identifier = string | number;
|
|
12
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export interface TraceReferencedEntity {
|
|
2
2
|
entity: string;
|
|
3
|
-
identifier?:
|
|
3
|
+
identifier?: TraceReferencedEntity.Identifier;
|
|
4
4
|
reference?: string;
|
|
5
5
|
is_visible: boolean;
|
|
6
6
|
}
|
|
7
|
+
export declare namespace TraceReferencedEntity {
|
|
8
|
+
type Identifier = string | number;
|
|
9
|
+
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type * as Apollo from "../index.mjs";
|
|
2
2
|
export interface TraceSelfReviewEntity {
|
|
3
3
|
entity: string;
|
|
4
|
-
identifier?:
|
|
4
|
+
identifier?: TraceSelfReviewEntity.Identifier;
|
|
5
5
|
reference?: string;
|
|
6
6
|
sub_entities?: Apollo.TracSelfReviewSubEntity[];
|
|
7
7
|
self_review?: Apollo.TraceSelfReviewSection;
|
|
8
8
|
is_visible: boolean;
|
|
9
9
|
}
|
|
10
|
+
export declare namespace TraceSelfReviewEntity {
|
|
11
|
+
type Identifier = string | number;
|
|
12
|
+
}
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.2.
|
|
1
|
+
export declare const SDK_VERSION = "1.2.41";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "1.2.
|
|
1
|
+
export const SDK_VERSION = "1.2.41";
|