This page describes Model of the ChannelIO iOS SDK (hereafter referred to as SDK).

BootConfig

Configures option for ChannelIO.boot. This model is used as a parameter for the boot method.

fieldtypedescription
pluginKeyStringPlugin key of Channel.
memberIdString?An identifier to distinguish each member user.
memberHashString?A HMAC-SHA256 value of memberId. See enabling member hash.
profileProfile?A user’s profile.
languageLanguage?A user’s language.
It is valid when creating a new user. The language of the user that already exists will not change.
unsubscribeEmailBool? Sets whether to receive marketing messages via email.
unsubscribeTextingBool?Sets whether to receive marketing messages via texting (SMS, LMS)
trackDefaultEventBool?Sets whether to track the default event such as PageView.
hidePopupBool?Sets whether hide popups such as marketing popup and in-app notifications.
channelButtonOptionChannelButtonOption?An option for Channel button.
You can set the position and margin of the Channel button. The unit of margin is pt (point).
bubbleOptionBubbleOption?An option for popups for bubble type of marketing messages, and in-app notifications. The unit of margin is pt (point.)
appearanceAppearance?Sets appearance of SDK.

Language

Languages that the SDK supports.

@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

An option for modifying the position of Channel button.
You can set it left down or right down. The default value of position is right, the margin is 20 for each.

// Units of x and y are pt in iOS.
let buttonOption = ChannelButtonOption(
  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
                                     ];

BubbleOption

Sets the location and margin of the message and bubble-type marketing messages in the in-app.
Location defaults to top and margins default to 20 .

// 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

A user’s profile.

fieldtypedescription
nameString?A name of a user.
emailString?An email of a user.
mobileNumberString?A mobile number of a user.
avatarUrlString?An avatar URL of a user.

User

A user who has visited a website or app with Channel installed.

fieldtypedescription
idStringAn identifier that Channel uses.
memberIdString?An identifier to distinguish member users. Anonymous user is null.
nameString?A name of the user.
avatarUrlString?An avatar URL of the user.
profile[String: Any]?An object that contains the user’s profile.
alertIntAn unread message count of the user.
tags[String]?A tag list of the user.
languageLanguageA language of the user.
unsubscribeTextingBoolWhether to receive marketing messages via email.
unsubscribeEmailBoolWhether to receive marketing messages via texting (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 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

Data of the in-app popup.

fieldtypedescription
chatIdStringA chat Id of the popup.
avatarUrlStringA avatar URL of the popup.
nameStringA name which displayed on the popup.
messageStringA message which displayed on the popup.
@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

A model used for data configuration on updateUser.

fieldtypedescription
languageLanguageA user’s language.
tags[String]?A user’s tag list.
Overwrite with tag data you add.
The maximum number is ten and is not case-sensitive.
profile[String: Any]?A user’s profile.
Overwrite with profile data you add. Initialize if you set the profile value to nil.
profileOnce[String: Any]?A profile to add to the user.
Add a new profile value it it does not exist.
unsubscribeEmailBoolWhether to receive marketing messages via email.
unsubscribeTextingBoolWhether to receive marketing messages via texting (SMS, LMS)

Examples are the following:

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
  }
}];

BootStatus

An enum object for the boot result.

fielddescription
successThe boot was successful.
notInitializedChannelIO.initialize was not called.
networkTimeoutThe boot failed because of a network issue.
notAvailableVersionNot a supported SDK version.
serviceUnderConstructionChannel.io server is under construction.
requirePaymentThe channel is blocked or you need to check the subscription plan.
accessDeniedServer responded with 4xx status code.
unknownAn unknown error.
@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,
};