UNPKG

@channel.io/channel-talk-integration-mcp

Version:

Channel Talk Integration MCP - Installation guides for Channel Talk SDK across multiple platforms

424 lines (324 loc) 11.6 kB
import { z } from "zod"; export function registerGetIOSGuideTool(server) { server.tool("get_ios_guide", `case1: 유저가 iOS 앱에 채널톡을 설치하는 방법을 알고 싶다고 말하면 툴을 호출합니다. case2: 이전 툴의 next_step에서 get_ios_guide를 호출해야할 경우 툴을 호출합니다.`, { language: z .enum(["ko", "en"]) .optional() .describe("Language for the guide. Use 'en' for English, defaults to Korean if not specified"), }, (args) => { try { const language = args.language; const result = language === "en" ? getEnglishIOSGuide() : getKoreanIOSGuide(); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { const message = error instanceof Error ? error.message : String(error); throw new Error(`Failed to execute get_ios_guide: ${message}`); } }); console.log("Registered tool: get_ios_guide"); } function getKoreanIOSGuide() { return { result: `# 채널톡 iOS SDK 설치 가이드 ChannelIO iOS SDK는 Swift/Objective-C로 작성된 iOS 애플리케이션에 실시간 상담 채팅 모듈을 쉽게 설치할 있는 플러그인입니다. ## 📋 시작하기 전 요구사항 ### 필수 조건 - **채널톡 유료 플랜** (무료 플랜은 SDK 사용 불가) - **Swift 5.0 이상** - **ChannelIO SDK 10.0.0 이상** 사용자가 필수 조건을 완료했는지 물어보세요. 완료되지 않았다면 필수 조건을 완료하도록 안내해주세요. 특히 무료플랜일 경우 유료 플랜으로 업그레이드 하도록 안내해주세요. ### 지원 iOS 버전 - **SDK v12.4.1 이상**: iOS 15+ - **SDK v12.4.0 이하**: iOS 12+ ### Privacy Manifest - **SDK v11.5.0 이상**: \`PrivacyInfo.xcprivacy\` 파일 포함 - App Store 제출 Privacy manifest 필요한 경우 해당 버전 이상 사용 --- ## 📦 설치 방법 (3가지 옵션) ${getIOSInstallationOptions()} --- ## 🔐 권한 설정 (Info.plist) ${getIOSPermissionSettings()} --- ## 🚀 SDK 구현 가이드 ${getIOSImplementationGuide()} --- ## ⚠️ 중요 보안 권장사항 ${getIOSSecurityRecommendations()} --- ## 🔧 구현 체크리스트 ${getIOSChecklist()} --- ## 💡 문제 해결 ### 자주 발생하는 이슈 1. **부트 실패**: 플러그인 확인, 네트워크 연결 확인 2. **권한 오류**: Info.plist 권한 설명 추가 확인 3. **빌드 오류**: Swift 버전, iOS 최소 버전 확인 ### 성능 최적화 - 부트는 시작 번만 실행 - 불필요한 showChannelButton 호출 최소화 - 이벤트 트래킹은 필요한 경우에만 사용 **📚 참고 문서**: https://developers.channel.io/reference/ios-quickstart-kr **🔗 GitHub**: https://github.com/channel-io/channel-talk-ios-framework`, }; } function getEnglishIOSGuide() { return { result: `# Channel Talk iOS SDK Installation Guide ChannelIO iOS SDK is a plugin that allows you to easily install real-time customer support chat modules in iOS applications written in Swift/Objective-C. ## 📋 Requirements Before Starting ### Prerequisites - **Channel Talk paid plan** (Free plan cannot use SDK) - **Swift 5.0 or higher** - **ChannelIO SDK 10.0.0 or higher** Please ask if the user has completed the prerequisites. If not, guide them to complete the prerequisites. Especially if they're on a free plan, guide them to upgrade to a paid plan. ### Supported iOS Versions - **SDK v12.4.1 and above**: iOS 15+ - **SDK v12.4.0 and below**: iOS 12+ ### Privacy Manifest - **SDK v11.5.0 and above**: Includes \`PrivacyInfo.xcprivacy\` file - Use this version or higher when Privacy manifest is required for App Store submission --- ## 📦 Installation Methods (3 Options) ${getIOSInstallationOptions()} --- ## 🔐 Permission Settings (Info.plist) ${getIOSPermissionSettings()} --- ## 🚀 SDK Implementation Guide ${getIOSImplementationGuide()} --- ## ⚠️ Important Security Recommendations ${getIOSSecurityRecommendations()} --- ## 🔧 Implementation Checklist ${getIOSChecklist()} --- ## 💡 Troubleshooting ### Common Issues 1. **Boot failure**: Check plugin key, network connection 2. **Permission errors**: Verify Info.plist permission descriptions 3. **Build errors**: Check Swift version, iOS minimum version ### Performance Optimization - Execute boot only once at app startup - Minimize unnecessary showChannelButton calls - Use event tracking only when necessary **📚 Reference Documentation**: https://developers.channel.io/reference/ios-quickstart **🔗 GitHub**: https://github.com/channel-io/channel-talk-ios-framework`, }; } function getIOSInstallationOptions() { return `### 옵션 1: Swift Package Manager (권장) **Xcode 11 이상 필요** \`\`\` 1. Xcode 네비게이터에서 프로젝트 선택 2. Swift Package '+' 버튼 클릭 3. 패키지 URL 입력: https://github.com/channel-io/channel-talk-ios-framework 4. 버전 설정 'Add Package' 클릭 \`\`\` ### 옵션 2: CocoaPods **CocoaPods 1.10.0 이상 필요** \`\`\`ruby # Podfile에 추가 pod 'ChannelIOSDK' # 특정 버전 지정 시 pod 'ChannelIOSDK', '12.4.1' \`\`\` \`\`\`bash # 설치 명령어 pod install # 이후 .xcworkspace 파일로 프로젝트 열기 \`\`\` ### 옵션 3: Carthage \`\`\` # Cartfile에 추가 binary "https://mobile-static.channel.io/ios/latest/channeliosdk-ios.json" \`\`\` \`\`\`bash # 설치 명령어 carthage update --platform iOS --use-xcframeworks # PROJECT_DIR/Carthage/build 폴더의 패키지를 Xcode에 드래그&드롭 \`\`\``; } function getIOSPermissionSettings() { return `설치 \`Info.plist\`에 다음 권한 설명을 추가해야 합니다: \`\`\`xml <!-- 필수 권한 --> <key>NSCameraUsageDescription</key> <string>Accessing the camera to provide a better user experience</string> <key>NSPhotoLibraryAddUsageDescription</key> <string>Accessing the photo library to provide a better user experience</string> <key>NSMicrophoneUsageDescription</key> <string>Accessing the microphone to record voice for video</string> <!-- SDK 10.0.7 미만 또는 iOS 13 미만 지원 추가 --> <key>NSPhotoLibraryUsageDescription</key> <string>Accessing to photo library in order to save photos</string> \`\`\``; } function getIOSImplementationGuide() { return `### 1️⃣ Framework Import \`\`\`swift // Swift import ChannelIOFront \`\`\` \`\`\`objc // Objective-C #import <ChannelIOFront/ChannelIOFront-swift.h> \`\`\` ### 2️⃣ 초기화 (AppDelegate) \`\`\`swift // AppDelegate.swift import UIKit import ChannelIOFront @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // 채널톡 초기화 ChannelIO.initialize(application) return true } } \`\`\` \`\`\`objc // Objective-C AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [ChannelIO initialize:application]; return YES; } \`\`\` ### 3️⃣ Boot 설정 #### 익명 유저로 부트 \`\`\`swift let bootConfig = CHTBootConfig(pluginKey: "YOUR_PLUGIN_KEY") // 실제 키로 교체 ChannelIO.boot(with: bootConfig) { (bootStatus, user) in if bootStatus == .success, let user = user { print("채널톡 부트 성공: \\(user)") } else { print("채널톡 부트 실패: \\(bootStatus)") } } \`\`\` #### 멤버 유저로 부트 (로그인 사용자) \`\`\`swift // 사용자 프로필 설정 let profile = CHTProfile() .set(name: "사용자명") .set(propertyKey: "customField1", value: "커스텀값1") // 채널 버튼 옵션 let buttonOption = CHTChannelButtonOption( position: .right, // 버튼 위치 xMargin: 16, // 가로 여백 yMargin: 23 // 세로 여백 ) // 부트 설정 let bootConfig = CHTBootConfig( pluginKey: "YOUR_PLUGIN_KEY", // 실제 키로 교체 memberId: "USER_UNIQUE_ID", // 유저 고유 ID memberHash: "USER_MEMBER_HASH", // 보안을 위한 해시값 profile: profile, channelButtonOption: buttonOption, hidePopup: false, // 마케팅 팝업 표시 여부 trackDefaultEvent: true, // 기본 이벤트 트래킹 language: .korean // 언어 설정 ) ChannelIO.boot(with: bootConfig) { (bootStatus, user) in if bootStatus == .success { print("멤버 유저 부트 성공") } else { print("부트 실패: \\(bootStatus)") } } \`\`\` ### 4️⃣ 채널 버튼 제어 \`\`\`swift // 채널 버튼 표시 ChannelIO.showChannelButton() // 채널 버튼 숨기기 ChannelIO.hideChannelButton() // 메신저 직접 열기 ChannelIO.open() // 메신저 닫기 ChannelIO.close() \`\`\` ### 5️⃣ 고급 기능 #### Sleep 모드 (이벤트 트래킹만 사용) \`\`\`swift // 채팅 상담, 마케팅 팝업 비활성화, 이벤트 트래킹만 사용 ChannelIO.sleep() \`\`\` #### Shutdown (완전 종료) \`\`\`swift // SDK 모든 기능 중지 (재사용 다시 boot 필요) ChannelIO.shutdown() \`\`\` #### 이벤트 트래킹 \`\`\`swift // 사용자 행동 추적 ChannelIO.track("Purchase", properties: [ "orderId": "ORD-12345", "amount": 29.99, "currency": "USD" ]) ChannelIO.track("ViewProduct", properties: [ "productId": "PROD-001", "category": "Electronics" ]) \`\`\``; } function getIOSSecurityRecommendations() { return `### 멤버 해시 사용 \`\`\`swift // 예측 가능한 memberId 사용 금지 let bootConfig = CHTBootConfig( pluginKey: "YOUR_PLUGIN_KEY", memberId: "user@email.com" // 위험: 예측 가능 ) // 서버에서 생성한 해시값 사용 권장 let bootConfig = CHTBootConfig( pluginKey: "YOUR_PLUGIN_KEY", memberId: "USER_UNIQUE_ID", memberHash: serverGeneratedHash // 안전: 서버 생성 해시 ) \`\`\``; } function getIOSChecklist() { return `### 프로젝트 설정 - [ ] 채널톡 유료 플랜 가입 확인 - [ ] Swift 5.0+ 또는 Objective-C 환경 확인 - [ ] iOS 최소 버전 요구사항 확인 ### SDK 설치 - [ ] 설치 방법 선택 (SPM/CocoaPods/Carthage) - [ ] 패키지 정상 설치 확인 - [ ] Privacy manifest 필요 SDK v11.5.0+ 사용 ### 권한 설정 - [ ] Info.plist에 카메라 권한 설명 추가 - [ ] Info.plist에 사진 라이브러리 권한 설명 추가 - [ ] Info.plist에 마이크 권한 설명 추가 ### 코드 구현 - [ ] AppDelegate에 ChannelIO 초기화 코드 추가 - [ ] 실제 플러그인 키로 "YOUR_PLUGIN_KEY" 교체 - [ ] 부트 설정 (익명 또는 멤버 유저) - [ ] 채널 버튼 표시/숨김 로직 구현 - [ ] 필요 이벤트 트래킹 추가 ### 보안 설정 - [ ] 멤버 유저 사용 memberHash 구현 - [ ] 서버 사이드 해시 생성 로직 구현 - [ ] 민감 정보 하드코딩 방지 ### 테스트 - [ ] 부트 성공/실패 상황 테스트 - [ ] 채널 버튼 표시 확인 - [ ] 메신저 정상 작동 확인 - [ ] 권한 요청 다이얼로그 표시 확인`; } //# sourceMappingURL=get-ios-guide.tool.js.map