@aui.io/aui-client 1.2.40 → 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 +106 -0
- 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
|
@@ -386,6 +386,53 @@ response.suggestions?.forEach((suggestion, index) => {
|
|
|
386
386
|
});
|
|
387
387
|
```
|
|
388
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
|
+
|
|
389
436
|
---
|
|
390
437
|
|
|
391
438
|
### WebSocket API
|
|
@@ -712,6 +759,63 @@ getSuggestedQuestions('task-123', 'user-456');
|
|
|
712
759
|
// 3. "Can I schedule a test drive?"
|
|
713
760
|
```
|
|
714
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
|
+
|
|
715
819
|
## 🔧 Advanced Configuration
|
|
716
820
|
|
|
717
821
|
### Custom Timeout and Retries
|
|
@@ -793,6 +897,7 @@ import {
|
|
|
793
897
|
CreateExternalTaskRequest,
|
|
794
898
|
SubmitExternalMessageRequest,
|
|
795
899
|
UserMessagePayload,
|
|
900
|
+
TextConversationInitiateRequest,
|
|
796
901
|
// Response types
|
|
797
902
|
CreateExternalTaskResponse,
|
|
798
903
|
ExternalTaskMessage,
|
|
@@ -800,6 +905,7 @@ import {
|
|
|
800
905
|
StreamingUpdatePayload,
|
|
801
906
|
FinalMessagePayload,
|
|
802
907
|
ErrorMessagePayload,
|
|
908
|
+
TextConversationInitiateResponse,
|
|
803
909
|
// Error types
|
|
804
910
|
ApolloError,
|
|
805
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";
|