Models
BootConfig
Configures option for ChannelIO.boot
. This model is used as a parameter for the boot
method.
field | type | description |
---|---|---|
pluginKey | String | Plugin key of Channel. |
memberId | String? | An identifier to distinguish each member user. |
memberHash | String? | A HMAC-SHA256 value of memberId. See enabling member hash. |
profile | Profile? | A user’s profile. |
language | Language? | A user’s language. It is valid when creating a new user. The language of the user that already exists will not change. |
unsubscribeEmail | Bool? | Sets whether to receive marketing messages via email. |
unsubscribeTexting | Bool? | Sets whether to receive marketing messages via texting (SMS, LMS) |
trackDefaultEvent | Bool? | Sets whether to track the default event, such as PageView. |
hidePopup | Bool? | Sets whether to hide popups such as marketing popup and in-app notifications. |
channelButtonOption | ChannelButtonOption? | An option for the Channel button. You can set the appearance and position of the Channel button. The unit of the margin is pt (point). |
bubbleOption | BubbleOption? | An option for popups for bubble-type marketing messages and in-app notifications. The unit of margin is pt (point.) |
appearance | Appearance? | Sets the 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
Configures the appearance and location of the Channel Button.
The icon's appearance can be set using the ChannelButtonIcon, and the position can be set to the bottom left or right. The default value for position is .right
and the default value for margin is 20pt each.
// 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
];
변수명 | 타입 | 설명 |
---|---|---|
icon | ChannelButtonIcon | Sets the appearance of the Channel Button. The default value is .channel .(SDK >= 11.0.0) |
position | ChannelButtonPosition | Sets the location of the Channel button. The default value is .right . |
xMargin | Float | Sets the x-axis base margin for the Channel Button. The units are pt . |
yMargin | Float | Sets the y-axis base margin for the Channel Button. The units are pt |
ChannelButtonPosition
Sets the location of the Channel Button.
@objc
public enum ChannelButtonPosition: Int {
case right
case left
}
BubbleOption
Sets the location and margin of the message and bubble-type marketing messages in the in-app.
The location is set to top
by default and margins are set to 20
by default.
// 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];
ChannelButtonIcon
Sets the appearance of the Channel button icon.
@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
}
Profile
A user’s profile.
field | type | description |
---|---|---|
name | String? | A name of a user. |
String? | An email of a user. | |
mobileNumber | String? | A mobile number of a user. |
avatarUrl | String? | An avatar URL of a user. |
User
A user who has visited a website or app with Channel installed.
field | type | description |
---|---|---|
id | String | An identifier that Channel uses. |
memberId | String? | An identifier to distinguish member users. An anonymous user's is null. |
name | String? | The name of the user. |
avatarUrl | String? | An avatar URL of the user. |
profile | [String: Any]? | An object that contains the user’s profile. |
alert | Int | The number of important notifications that the user has not read. It is displayed as a number on the Channel button. |
unread | Int | The number of all unread notifications the user has. It includes the number of alert . It is displayed as a red dot on the Channel button. |
tags | [String]? | A tag list of the user. |
language | Language | A language of the user. |
unsubscribeTexting | Bool | Whether to receive marketing messages via email. |
unsubscribeEmail | Bool | Whether 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.
field | type | description |
---|---|---|
chatId | String | A chat Id of the popup. |
avatarUrl | String | A avatar URL of the popup. |
name | String | A name which displayed on the popup. |
message | String | A 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
.
field | type | description |
---|---|---|
language | Language | A user’s language. |
tags | [String]? | A user’s tag list. Overwrite with tag data you add. The maximum number is 20, and it is not case-sensitive. |
profile | [String: Any]? | A user’s profile. Overwrite with profile data you add. Initialize when you set the profile value to nil. |
profileOnce | [String: Any]? | A profile to add to the user. Add a new profile value if it does not exist. |
unsubscribeEmail | Bool | Whether to receive marketing messages via email. |
unsubscribeTexting | Bool | Whether 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
}
}];
Appearance
An enum object for the appearance of the SDK.
@objc
public enum Appearance: Int {
case system
case light
case dark
}
BootStatus
An enum object for the boot result.
field | description |
---|---|
success | The boot was successful. |
notInitialized | ChannelIO.initialize was not called. |
networkTimeout | The boot failed because of a network issue. |
notAvailableVersion | Not a supported SDK version. |
serviceUnderConstruction | Channel Talk server is under construction. |
requirePayment | The channel is blocked or you need to check the subscription plan. |
accessDenied | Server responded with 4xx status code. |
unknown | An 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,
};
Updated 5 months ago