이 문서는 채널톡 iOS SDK(이하 SDK)에서 사용하는 모델에 대해 설명합니다.

BootConfig

ChannelIO.boot 의 옵션을 설정합니다. boot 메소드의 매개변수로 전달하는 모델입니다. 사용 예제는 시작하기 문서를 참고합니다.

변수명타입설명
pluginKeyString채널의 플러그인 키입니다.
memberIdString?멤버 유저를 구분하는 id입니다.
memberHashString?memberId의 해시화 된 값입니다. 더 자세한 내용은 맴버 해시를 참고합니다.
profileProfile?유저의 프로필 값입니다.
languageLanguage?유저가 사용할 언어입니다.
유저를 새로 생성하는 경우에만 효력이 있습니다. 이미 존재하는 유저의 언어는 변경되지 않습니다.
unsubscribeEmailBool? 이메일을 통한 마케팅 메시지를 수신할 지 여부를 설정합니다.
unsubscribeTextingBool?문자 (sms, lms)를 통한 마케팅 메시지를 수신할 지 여부를 설정합니다.
trackDefaultEventBool?PageView와 같은 기본 이벤트를 전송할 지 여부를 설정합니다.
hidePopupBool?인앱에서 보이는 기본 마케팅 메시지와 메시지 알림 팝업을 보일지 여부를 설정합니다.
channelButtonOptionChannelButtonOption?채널 버튼의 모양과 위치를 설정합니다. 여백의 단위는 pt (point) 입니다.
bubbleOptionBubbleOption?인앱에서 보이는 기본 메시지 알림, 마케팅 버블의 위치와 여백을 설정합니다.
여백의 단위는 pt (point) 입니다.
appearanceAppearance?SDK의 화면 테마를 설정합니다.

Language

SDK가 지원하는 언어입니다.

@objc public enum LanguageOption: Int {
  case english
  case korean
  case japanese
  case device
}
typedef SWIFT_ENUM(NSInteger, LanguageOption, closed) {
  LanguageOptionEnglish = 0,
  LanguageOptionKorean = 1,
  LanguageOptionJapanese = 2,
  LanguageOptionDevice = 3,
};

ChannelButtonOption

채널 버튼의 아이콘 모양과 위치를 설정합니다.
아이콘은 ChannelButtonIcon을 통해 설정할 수 있고, 위치는 왼쪽 아래 또는 오른쪽 아래로 위치를 설정할 수 있습니다. 위치의 기본값은 right, 여백의 기본값은 각 20pt입니다.

// Units of x and y are pt in iOS.
let buttonOption = ChannelButtonOption(
  icon: .channel,
  position: .left,
  xMargin: 16,
  yMargin: 23
)
// Units of x and y are pt in iOS.
ChannelButtonOption *buttonOption = [
  [ChannelButtonOption alloc]
	initWithPosition:ChannelButtonPositionLeft
	xMargin:16
	yMargin:23
];
변수명타입설명
iconChannelButtonIcon채널 버튼의 아이콘을 설정합니다. 기본값은 channel 입니다.
(SDK >= 11.0.0)
positionChannelButtonPosition채널 버튼의 위치를 설정합니다. 기본값은 right 입니다.
xMarginFloat채널 버튼의 x축 기준 마진을 설정합니다. 단위는 pt 입니다.
yMarginFloat채널 버튼의 x축 기준 마진을 설정합니다. 단위는 pt 입니다.

ChannelButtonPosition

채널 버튼의 위치를 설정합니다.

@objc  
public enum ChannelButtonPosition: Int {  
  case right  
  case left  
}

ChannelButtonIcon

채널 버튼의 아이콘을 설정합니다.

@objc
public enum ChannelButtonIcon: Int {
  case channel
  case chatBubbleFilled
  case chatProgressFilled
  case chatQuestionFilled
  case chatLightningFilled
  case chatBubbleAltFilled
  case smsFilled
  case commentFilled
  case sendForwardFilled
  case helpFilled
  case chatProgress
  case chatQuestion
  case chatBubbleAlt
  case sms
  case comment
  case sendForward
  case communication
  case headset
}

BubbleOption

인앱에서 발생하는 메시지 알림, 마케팅 버블의 위치와 여백을 설정합니다.
위치의 기본값은 top , 여백의 기본값은 20pt입니다.

// Units of x and y are pt in iOS.
let bubbleOption = BubbleOption(
  position: .top, // .top or .bottom
  yMargin: 0
)
// Units of x and y are pt in iOS.
    BubbleOption *bubbleOption = [[BubbleOption alloc] init];
  [bubbleOption setPosition:BubblePostitionTop]; // BubblePostitionTop or BubblePostitionBottom
  [bubbleOption setYMargin:0];

Profile

유저의 프로필 객체입니다.

변수명타입설명
nameString?유저의 이름입니다.
emailString?유저의 email 입니다.
mobileNumberString?유저의 핸드폰 번호입니다.
avatarUrlString?유저의 이미지 URL 입니다.

User

채널톡이 설치된 웹사이트, 또는 앱을 방문한 모든 유저 객체입니다.

변수명타입설명
idStringSDK에서 사용하는 고유 식별자입니다.
memberIdString?유저를 구분하는 식별자입니다.
nameString?유저의 이름입니다.
avatarUrlString?유저 프로필 이미지의 URL입니다.
profile[String: Any]?유저의 프로필 정보를 담은 객체입니다.
alertInt유저가 읽지 않은 중요 알림 갯수입니다. 채널 버튼에서 숫자로 알림이 표현됩니다.
unreadInt유저가 읽지 않은 모든 알림 갯수입니다. alert 메시지의 수를 포함합니다. 채널 버튼에서 빨간 점으로 알림이 표현됩니다.
tags[String]?유저의 태그입니다.
languageLanguage유저의 초기 언어입니다.
unsubscribeTextingBool이메일을 통한 마케팅 메시지를 수신할 지 여부를 설정합니다.
unsubscribeEmailBool문자 (sms, lms)를 통한 마케팅 메시지를 수신할 지 여부를 설정합니다.
@objc
public class User: NSObject {
  @objc public let id: String
  @objc public let memberId: String
  @objc public let name: String
  @objc public let avatarUrl: String?
  @objc public let profile: [String : Any]?
  @objc public let alert: Int
  @objc public let unread: Int
  @objc public let tags: [String]?
  @objc public let language: String?
  @objc public let unsubscribeEmail: Bool
  @objc public let unsubscribeTexting: Bool
}
@interface User : NSObject
@property (nonatomic, readonly, copy) NSString * _Nonnull id;
@property (nonatomic, readonly, copy) NSString * _Nonnull memberId;
@property (nonatomic, readonly, copy) NSString * _Nonnull name;
@property (nonatomic, readonly, copy) NSString * _Nullable avatarUrl;
@property (nonatomic, readonly, copy) NSDictionary<NSString *, id> * _Nullable profile;
@property (nonatomic, readonly) NSInteger alert;
@property (nonatomic, readonly, copy) NSArray<NSString *> * _Nullable tags;
@property (nonatomic, readonly, copy) NSString * _Nullable language;
@property (nonatomic, readonly) BOOL unsubscribeEmail;
@property (nonatomic, readonly) BOOL unsubscribeTexting;
@end

PopupData

인앱 팝업 객체입니다.

변수명타입설명
chatIdString팝업의 대상이 되는 채팅방의 ID입니다.
avatarUrlString팝업의 아바타 URL입니다.
nameString팝업에서 표시할 이름입니다.
messageString팝업에서 표시할 메시지입니다.
@objc
public class PopupData: NSObject {
  @objc public let chatId: String
  @objc public let message: String
  @objc public let name: String
  @objc public let avatarUrl: String
}
@interface PopupData : NSObject
@property (nonatomic, readonly, copy) NSString * _Nonnull chatId;
@property (nonatomic, readonly, copy) NSString * _Nonnull message;
@property (nonatomic, readonly, copy) NSString * _Nonnull name;
@property (nonatomic, readonly, copy) NSString * _Nonnull avatarUrl;
@end

UserData

updateUser 의 데이터 구성에 사용하는 모델입니다.

변수명타입설명
languageLanguage유저가 사용할 언어입니다.
tags[String]?유저의 태그입니다.
추가하는 태그 데이터로 덮어 씌웁니다. 최대 갯수는 10개이며, 대소문자를 구분하지 않습니다. (소문자로 처리합니다)
profile[String: Any]?유저의 프로필 정보를 담은 객체입니다.
추가하는 프로필 정보로 덮어 씌웁니다. null로 설정한 경우 프로필 정보를 초기화 합니다.
profileOnce[String: Any]?유저에 추가할 프로필 정보입니다.
해당 프로필 값이 없는 경우 새로 추가합니다.
unsubscribeEmailBool이메일을 통한 마케팅 메시지를 수신할 지 여부를 설정합니다.
unsubscribeTextingBool문자(sms, lms)를 통한 마케팅 메시지를 수신할 지 여부를 설정합니다.
var profile: [String: Any] = [:]

// name
profile["name"] = USER_NAME
  
// mobileNumber
profile["mobileNumber"] = "+~~~"
  
// email
profile["email"] = EMAIL
  
// avatar url
profile["avatarUrl"] = AVATAR_URL
  
// other
profile[OTHER_KEY] = OTHER_VALUE
  
let userData = UpdateUserParamBuilder
  .with(language: .english)
  .with(profile: profile)
  .build()
    
ChannelIO.updateUser(param: userData) { (error, user) in
  if let user = user, error != nil {
    // success, result data is user
  } else if let error = error {
    // error, see error
  }
}
UpdateUserParamObjcBuilder *builder = [[UpdateUserParamObjcBuilder alloc] init];

// name
[builder withProfileKey:@"name" value:USER_NAME];

// mobileNumber
[builder withProfileKey:@"mobileNumber" value:@"+~~~"];
  
// email
[builder withProfileKey:@"email" value:EMAIL];
  
// avatar url
[builder withProfileKey:@"avatarUrl" value:AVATAR_URL];
  
// other
[builder withProfileKey:@"OTHER_KEY" value:OTHER_VALUE];

[builder withLanguage:LanguageOptionEnglish];

[ChannelIO updateUserWithParam:[builder build] completion:^(NSError * error, User * user) {
  if (user != nil && error == nil) {
    // success, result data is user
  } else (error != nil) {
    // error, see error
  }
}];

Appearance

SDK의 테마를 나타내는 객체입니다.

@objc
public enum Appearance: Int {
  case system
  case light
  case dark
}

BootStatus

부트 결과에 대한 enum 객체입니다.

변수명설명
successboot가 성공했습니다.
notInitializedChannelIO.initialize()가 호출되지 않았습니다.
networkTimeout네트워크 문제로 ChannelIO.boot가 실패했습니다.
notAvailableVersion지원되지 않는 SDK 버전입니다.
serviceUnderConstruction채널톡 서버가 점검 중입니다.
requirePayment채널이 차단되었거나 유료 결제가 필요한 경우입니다.
accessDenied서버에서 4xx 에러를 반환했습니다.
unknown알 수 없는 오류입니다.
@objc
public enum BootStatus : Int {
  case success
  case notInitialized
  case networkTimeout
  case notAvailableVersion
  case serviceUnderConstruction
  case requirePayment
  case accessDenied
  case unknown
}
typedef SWIFT_ENUM(NSInteger, BootStatus, closed) {
  BootStatusSuccess = 0,
  BootStatusNotInitialized = 1,
  BootStatusNetworkTimeout = 2,
  BootStatusNotAvailableVersion = 3,
  BootStatusServiceUnderConstruction = 4,
  BootStatusRequirePayment = 5,
  BootStatusAccessDenied = 6,
  BootStatusUnknown = 7,
};