Skip to content

Commit 7b37acf

Browse files
authored
Merge branch 'main' into feature/tez/improve-session-info-desc
2 parents 3fb8263 + 9352d9f commit 7b37acf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+3545
-178
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
**/dist
33
**/.vite
44
**/deps
5+
**/.pnpm-store
6+
**/pnpm-lock.yaml
7+
**/playwright-report/**
8+
**/test-results
59
.idea
10+
CLAUDE.md
611

712
### Xcode ###
813
## User settings
@@ -24,4 +29,4 @@ xcuserdata/
2429
**/*.xcuserdatad
2530
**/Package.resolved
2631

27-
# End of https://www.toptal.com/developers/gitignore/api/xcode
32+
# End of https://www.toptal.com/developers/gitignore/api/xcode

README.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,36 @@ To integrate Sendbird AI Agent into your application, follow these steps:
3131

3232
## Repository Structure
3333

34-
This repository contains platform-specific implementations of the Sendbird AI Agent:
34+
This repository contains platform-specific implementations and customer guides for the Sendbird AI Agent:
3535

36-
- **iOS**: Located in the `ios` directory, this includes the Swift Package Manager (SPM) compatible SDK for integrating the AI agent into iOS applications.
36+
- **JavaScript**: Located in the `js` directory, includes:
37+
- Documentation guides for React and CDN integration
38+
- Interactive live examples
39+
- Downloadable sample projects for local development
3740

38-
- **Android**: Located in the `android` directory, this includes the necessary components for Android integration.
41+
- **iOS**: Located in the `ios` directory, includes Swift integration guides and sample applications.
3942

40-
- **Web**: Located in the `js` directory, this includes JavaScript components for web integration.
43+
- **Android**: Located in the `android` directory, includes Android integration documentation.
44+
45+
### JavaScript Sample Projects
46+
47+
Each JavaScript platform directory contains a ready-to-run sample project:
48+
49+
- **`js/react/sample/`**: Vite + TypeScript + React sample with full AI Agent integration
50+
- **`js/cdn/sample/`**: Vite + Vanilla JavaScript sample using CDN integration
51+
52+
Both samples demonstrate:
53+
- Basic AI Agent Messenger integration
54+
- User authentication and session handling
55+
- Context configuration
56+
- Manual messenger controls
57+
58+
To run the samples locally:
59+
```bash
60+
cd js/react/sample # or js/cdn/sample
61+
npm install
62+
npm run dev
63+
```
4164

4265
Each platform-specific directory contains its own README with detailed integration instructions.
4366

android/README.md

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,31 @@ Now that you have installed and initialized the AI Agent SDK, follow the steps b
181181
### Manage user sessions
182182

183183
To use the SDK, session information is required.
184-
Before using `AIAgentMessenger`, you must set the session information for the application user issued by Sendbird.
184+
The SDK supports two types of user sessions: **Manual Session** for authenticated users and **Anonymous Session** for temporary users.
185+
186+
#### Session Types
187+
188+
**1. Manual Session (ManualSessionInfo):**
189+
Use this when you have an authenticated user with a specific user ID and session token.
190+
191+
```kotlin
192+
val manualSessionInfo = ManualSessionInfo(
193+
userId = "your_user_id",
194+
sessionToken = "your_session_token",
195+
sessionHandler = YourSessionHandler()
196+
)
197+
AIAgentMessenger.updateSessionInfo(manualSessionInfo)
198+
```
199+
200+
**2. Anonymous Session (AnonymousSessionInfo):**
201+
Use this for temporary users when you don't have user authentication. The server will automatically create a temporary user.
202+
203+
```kotlin
204+
val anonymousSessionInfo = AnonymousSessionInfo()
205+
AIAgentMessenger.updateSessionInfo(anonymousSessionInfo)
206+
```
207+
208+
> **⚠️ Important Note for Anonymous Sessions:** Since anonymous users are temporary and generated by the server, conversation history may not persist across different app sessions. Users might not see their previous conversations when they reconnect.
185209
186210
#### When to set the session information:
187211

@@ -191,17 +215,15 @@ Since there is no session information for the user at the first login, it should
191215
2. **For already logged-in users:**
192216
If the user is already logged in, the session should be registered immediately after SDK initialization.
193217

194-
```kotlin
195-
val userSessionInfo = UserSessionInfo(userId, authToken, AbstractSessionHandler())
196-
AIAgentMessenger.updateSessionInfo(userSessionInfo)
197-
```
198-
> SessionHandler is the handler used when a session expires or needs to be renewed. See [next guide](#handle-session-expiration) for instructions on how to use it.
218+
> SessionHandler is the handler used when a session expires or needs to be renewed (only applicable for ManualSessionInfo). See [next guide](#handle-session-expiration) for instructions on how to use it.
199219
200220
### Handle session expiration
201221

202-
When registering a session information, the provided session handler must handle the case where the session information expires.
222+
When using `ManualSessionInfo`, the provided session handler must handle the case where the session information expires.
203223
Follow the code below to refresh and provide a new session token in the session handler callback.
204224

225+
> **Note:** Session expiration handling is only applicable when using `ManualSessionInfo`. `AnonymousSessionInfo` does not require session token management.
226+
205227
#### How to handle session expiration:
206228

207229
1. Detect session expiration in the session handler callback.
@@ -256,7 +278,20 @@ To add the MessengerLauncher to your screen, simply call the `attach()` function
256278
MessengerLauncher(context, "your_ai_agent_id").attach()
257279
```
258280

259-
- `LauncherLayoutParams` allows you to configure the MessengerLauncher’s behavior and appearance:
281+
- **`entryPoint`**: Controls which screen is displayed first when the MessengerLauncher is clicked:
282+
283+
```kotlin
284+
val entryPoint = MessengerEntryPoint.CONVERSATION // or MessengerEntryPoint.CONVERSATION_LIST
285+
MessengerLauncher(this, "your_ai_agent_id", LauncherSettingsParams(entryPoint = entryPoint)).attach()
286+
```
287+
288+
Available options:
289+
- `MessengerEntryPoint.CONVERSATION`: Opens directly to the conversation screen (default)
290+
- `MessengerEntryPoint.CONVERSATION_LIST`: Opens to the conversation list screen
291+
292+
Use `CONVERSATION` for single AI agent conversations, or `CONVERSATION_LIST` when multiple conversation channels are available.
293+
294+
- `LauncherLayoutParams` allows you to configure the MessengerLauncher's behavior and appearance:
260295
- **`launchMode`**:
261296
- `EXPANDED`: Opens the messenger in full-screen mode with predefined margins.
262297
- `ANCHORED`: Opens the messenger anchored near the launcher button, with adjustable positioning.

ios/README.md

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ The **Sendbird AI Agent Messenger** allows seamless integration of chatbot featu
2525
- [Unregister for push notifications](#unregister-for-push-notifications)
2626
- [Advanced features](#advanced-features)
2727
- [Customize launcher mode](#customize-launcher-mode)
28+
- [Entry Point Advanced Configuration Guide](#entry-point-advanced-configuration-guide)
29+
- [Entry Point Types](#entry-point-types)
30+
- [Launcher-based Entry Point Configuration](#launcher-based-entry-point-configuration)
31+
- [Basic Setup](#basic-setup)
32+
- [Direct ViewController Presentation](#direct-viewcontroller-presentation)
33+
- [Present Conversation](#present-conversation)
34+
- [Present Conversation List](#present-conversation-list)
2835
- [Update SDK Theme](#update-sdk-theme)
2936
- [Deauthenticate and clear session](#deauthenticate-and-clear-session)
3037
- [Passing context object to Agent](#passing-context-object-to-agent)
@@ -155,6 +162,8 @@ extension MyViewController: SessionDelegate {
155162
// Refresh token from your server
156163
AuthService.refreshToken { newToken in
157164
if let token = newToken {
165+
// When success completion is called, updateSessionInfo is called internally,
166+
// which causes the SDK to update the token.
158167
success(token)
159168
} else {
160169
fail()
@@ -191,7 +200,7 @@ Display a floating launcher button:
191200

192201
```swift
193202
AIAgentMessenger.attachLauncher(
194-
aiAgentId: self.aiAgentId
203+
aiAgentId: {AIAgentId}
195204
)
196205
```
197206

@@ -276,6 +285,70 @@ AIAgentMessenger.attachLauncher(
276285
}
277286
```
278287

288+
### Entry Point Advanced Configuration Guide
289+
290+
This guide covers advanced entry point configuration options for the Sendbird AI Agent iOS SDK.
291+
292+
#### Entry Point Types
293+
294+
The SDK supports two entry point types:
295+
296+
```swift
297+
public enum SBAEntryPoint {
298+
case conversation // Direct to chat conversation (default)
299+
case conversationList // Show conversation list first
300+
}
301+
```
302+
303+
- **`.conversation`**: Opens directly to the chat conversation interface
304+
- **`.conversationList`**: Shows a list of existing conversations first
305+
306+
#### Launcher-based Entry Point Configuration
307+
308+
##### Basic Setup
309+
310+
Configure entry point through launcher options:
311+
312+
```swift
313+
AIAgentMessenger.attachLauncher(
314+
aiAgentId: {AIAgentId}"
315+
) { params in
316+
params.options = SBALauncherOptions(
317+
entryPoint: .conversationList, // or .conversation (default)
318+
layout: .default,
319+
displayStyle: .overlay()
320+
)
321+
}
322+
```
323+
324+
#### Direct ViewController Presentation
325+
326+
##### Present Conversation
327+
328+
Use `presentConversation()` when you want to show the chat interface directly:
329+
330+
```swift
331+
AIAgentMessenger.presentConversation(
332+
aiAgentId: {AIAgentId}
333+
) { params in
334+
params.parent = self
335+
params.presentationStyle = .fullScreen
336+
}
337+
```
338+
339+
##### Present Conversation List
340+
341+
Use `presentConversationList()` to show the conversation list:
342+
343+
```swift
344+
AIAgentMessenger.presentConversationList(
345+
aiAgentId: {AIAgentId}
346+
) { params in
347+
params.parent = self
348+
params.presentationStyle = .fullScreen
349+
}
350+
```
351+
279352
### Update SDK Theme
280353
281354
You can customize the SDK’s color scheme to match your app's theme as shown below.
@@ -307,7 +380,7 @@ This allows for a more personalized and context-aware interaction experience.
307380
```swift
308381
// Case: Attach launcher
309382
AIAgentMessenger.attachLauncher(
310-
aiAgentId: TestConfig.aiAgentId
383+
aiAgentId: {AIAgentId}
311384
) { params in
312385
params.language = "en" // (opt)default: Locale.preferredLanguages.first
313386
params.countryCode = "US" // (opt)default: Locale.current.regionCode
@@ -318,7 +391,7 @@ AIAgentMessenger.attachLauncher(
318391
```swift
319392
// Case:
320393
AIAgentMessenger.presentConversation(
321-
aiAgentId: TestConfig.aiAgentId
394+
aiAgentId: {AIAgentId}
322395
) { params in
323396
params.language = "en" // (opt)default: Locale.preferredLanguages.first
324397
params.countryCode = "US" // (opt)default: Locale.current.regionCode

ios/sample/QuickStart.xcodeproj/project.pbxproj

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
7C71E7DA9216F9F86D741BB4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AA91801860324BF877C2336 /* AppDelegate.swift */; };
2525
812695A5C4C90FF7E4A3AB9B /* AIAgentStarterKit+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A7036E74B93599B2C6902A6 /* AIAgentStarterKit+Utils.swift */; };
2626
86EC93CA51BEB68AF7312F70 /* ExtendedSDKBridge+UIKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4615C5A09D614DDB39BE743B /* ExtendedSDKBridge+UIKit.swift */; };
27+
A41581E47D6F1E1336A9CF7E /* Splash in Frameworks */ = {isa = PBXBuildFile; productRef = BD5090BE228A912E78D3193F /* Splash */; };
2728
A5B4456ED545348FC3E7A084 /* ExtendedSDKBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D8BFB011EB64C4DE076D77E /* ExtendedSDKBridge.swift */; };
2829
C1761DEEDB4CB13BBDA9D9F6 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD615656F26260F609F3E19B /* ViewController.swift */; };
2930
DF4E553ADFAE538E35089963 /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6D418B3D75969A462EC6516A /* ViewController.xib */; };
@@ -64,6 +65,7 @@
6465
buildActionMask = 2147483647;
6566
files = (
6667
05EF3B883F179441278AD591 /* SendbirdAIAgentMessenger in Frameworks */,
68+
A41581E47D6F1E1336A9CF7E /* Splash in Frameworks */,
6769
E9134545B3A6C96D0326C579 /* UserNotifications.framework in Frameworks */,
6870
);
6971
runOnlyForDeploymentPostprocessing = 0;
@@ -174,13 +176,6 @@
174176
path = ExtendedSDK;
175177
sourceTree = "<group>";
176178
};
177-
"TEMP_E7192467-2C5D-4027-A17F-704A6E71EF68" /* Customization */ = {
178-
isa = PBXGroup;
179-
children = (
180-
);
181-
path = Customization;
182-
sourceTree = "<group>";
183-
};
184179
/* End PBXGroup section */
185180

186181
/* Begin PBXNativeTarget section */
@@ -199,6 +194,7 @@
199194
name = QuickStart;
200195
packageProductDependencies = (
201196
691283789AB5ADF115CAE086 /* SendbirdAIAgentMessenger */,
197+
BD5090BE228A912E78D3193F /* Splash */,
202198
);
203199
productName = QuickStart;
204200
productReference = 504F1132070E1B91DFDF8DBA /* AIAgent.app */;
@@ -253,6 +249,7 @@
253249
minimizedProjectReferenceProxies = 1;
254250
packageReferences = (
255251
802787721279F86457E913BE /* XCRemoteSwiftPackageReference "sendbird-ai-agent-messenger-ios" */,
252+
675F8C38FD2AE3D8230AF692 /* XCRemoteSwiftPackageReference "Splash" */,
256253
);
257254
preferredProjectObjectVersion = 77;
258255
projectDirPath = "";
@@ -352,7 +349,7 @@
352349
"@loader_path/Frameworks",
353350
);
354351
LLVM_LTO = YES;
355-
MARKETING_VERSION = 0.10.1;
352+
MARKETING_VERSION = 0.10.9;
356353
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
357354
MTL_FAST_MATH = YES;
358355
OTHER_SWIFT_FLAGS = "-Xfrontend -no-serialize-debugging-options";
@@ -393,7 +390,7 @@
393390
"@executable_path/Frameworks",
394391
"@loader_path/Frameworks",
395392
);
396-
MARKETING_VERSION = 0.10.1;
393+
MARKETING_VERSION = 0.10.9;
397394
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
398395
MTL_FAST_MATH = YES;
399396
OTHER_SWIFT_FLAGS = "-DDEBUG";
@@ -549,7 +546,7 @@
549546
"@loader_path/Frameworks",
550547
);
551548
LLVM_LTO = YES;
552-
MARKETING_VERSION = 0.10.1;
549+
MARKETING_VERSION = 0.10.9;
553550
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
554551
MTL_FAST_MATH = YES;
555552
OTHER_SWIFT_FLAGS = "-Xfrontend -no-serialize-debugging-options";
@@ -591,7 +588,7 @@
591588
"@executable_path/Frameworks",
592589
"@loader_path/Frameworks",
593590
);
594-
MARKETING_VERSION = 0.10.1;
591+
MARKETING_VERSION = 0.10.9;
595592
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
596593
MTL_FAST_MATH = YES;
597594
OTHER_SWIFT_FLAGS = "-DDEBUG";
@@ -641,12 +638,20 @@
641638
/* End XCConfigurationList section */
642639

643640
/* Begin XCRemoteSwiftPackageReference section */
641+
675F8C38FD2AE3D8230AF692 /* XCRemoteSwiftPackageReference "Splash" */ = {
642+
isa = XCRemoteSwiftPackageReference;
643+
repositoryURL = "https://github.com/JohnSundell/Splash";
644+
requirement = {
645+
kind = upToNextMajorVersion;
646+
minimumVersion = 0.16.0;
647+
};
648+
};
644649
802787721279F86457E913BE /* XCRemoteSwiftPackageReference "sendbird-ai-agent-messenger-ios" */ = {
645650
isa = XCRemoteSwiftPackageReference;
646651
repositoryURL = "https://github.com/sendbird/sendbird-ai-agent-messenger-ios";
647652
requirement = {
648653
kind = upToNextMajorVersion;
649-
minimumVersion = 0.10.4;
654+
minimumVersion = 0.10.9;
650655
};
651656
};
652657
/* End XCRemoteSwiftPackageReference section */
@@ -657,6 +662,11 @@
657662
package = 802787721279F86457E913BE /* XCRemoteSwiftPackageReference "sendbird-ai-agent-messenger-ios" */;
658663
productName = SendbirdAIAgentMessenger;
659664
};
665+
BD5090BE228A912E78D3193F /* Splash */ = {
666+
isa = XCSwiftPackageProductDependency;
667+
package = 675F8C38FD2AE3D8230AF692 /* XCRemoteSwiftPackageReference "Splash" */;
668+
productName = Splash;
669+
};
660670
/* End XCSwiftPackageProductDependency section */
661671
};
662672
rootObject = 7F2D84C08194A453C686D4F4 /* Project object */;

0 commit comments

Comments
 (0)