Models
This page describes Model of the Channel Talk React Native SDK (hereafter referred to as SDK).
BootConfig
Configures option for ChannelIO.boot. This model is used as a parameter for the boot method. For the example, See QuickStart.
field | type | description |
---|---|---|
pluginKey | string | Plugin Key of Channel. |
memberId | (optional) string | An identifier to distinguish each member user. |
memberHash | (optional) string | A HMAC-SHA256 value of memberId. See enabling member hash. |
profile | (optional) Profile | A user’s Profile. |
language | (optional) 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 | (optional) boolean | Sets whether to receive marketing messages via email. |
unsubscribeTexting | (optional) boolean | Sets whether to receive marketing messages via texting (SMS, LMS) |
trackDefaultEvent | (optional) boolean | Sets whether to track the default event such as PageView. |
hidePopup | (optional) boolean | Sets whether hide popups such as marketing popup and in-app notifications. |
channelButtonOption | (optional) ChannelButtonOption | An option for Channel button. You can set the position and margin of the Channel button. The unit of margin is pt (point). |
bubbleOption | (optional) BubbleOption | An option for popups for bubble type of marketing messages, and in-app notifications. The unit of margin is pt (point.) |
appearance | Appearance | Sets the appearance of SDK. |
const config = {
"pluginKey": YOUR_PLUGIN_KEY,
"memberId": MEMBER_ID,
"memberHash": MEMBER_HASH,
"profile": {
"name": NAME,
"email": EMAIL,
"mobileNumber": "+~~~",
"avatarUrl": AVATAR_URL,
OTHER_KEY: OTHER_VALUE,
},
"language": LANGUAGE, // "en", "ko", "jp"
"unsubscribeEmail": BOOLEAN,
"unsubscribeTexting": BOOLEAN,
"trackDefaultEvent": BOOLEAN,
"hidePopup": BOOLEAN,
"channelButtonOption": {
"xMargin": 16,
"yMargin": 16,
"position": POSITION, // "left", "right"
},
"bubbleOption": {
"yMargin": 30,
"position" POSITION, // "top", "bottom"
}
"appearance": APPEARANCE // "system", "light", "dark"
}
ChannelIO.boot(config).then((result) => {
// result.status
// result.user
})
Language
Languages that the SDK supports.
// Set language to Korean
"language": "ko"
// Set language to Japanese
"language": "jp"
// Set language to English
"language": "en"
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.
"channelButtonOption": {
"xMargin": 16,
"yMargin": 16,
"position": POSITION, // 'left', 'right'
}
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
.
"bubbleOption": {
"position": "top", // "top" or "bottom"
"yMargin": 0
}
ChannelButtonIcon
Sets the appearance of the Channel button icon.
"channel"
"chatBubbleFilled"
"chatProgressFilled"
"chatQuestionFilled"
"chatLightningFilled"
"chatBubbleAltFilled"
"smsFilled"
"commentFilled"
"sendForwardFilled"
"helpFilled"
"chatProgress"
"chatQuestion"
"chatBubbleAlt"
"sms"
"comment"
"sendForward"
"communication"
"headset"
Profile
A user’s profile.
field | type | description |
---|---|---|
name | (optional) string | A name of a user. |
(optional) string | A email of a user. | |
mobileNumber | (optional) string | A mobile number of a user |
avatarUrl | (optional) string | An avatar URL of a user. |
"profile": {
"name": NAME,
"email": EMAIL,
"mobileNumber": "+~~~",
"avatarUrl": AVATAR_URL,
OTHER_KEY: OTHER_VALUE,
}
User
An user who has visited a website or app with Channel Talk SDK installed.
Field | Type | Description |
---|---|---|
id | string | An identifier that Channel Talk uses. |
memberId | (optional) string | An identifier to distinguish member users. Anonymous user is null. |
name | (optional) string | A name of the user. |
avatarUrl | (optional) string | An avatar URL of the user. |
profile | (optional) object | An object that contains the user’s profile. |
alert | number | The number of important notifications that the user has not read. It is displayed as a number on the Channel button. |
unread | number | 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 | (optional) string | A tag list of the user. |
language | Language | A language of the user. |
unsubscribeTexting | (optional) boolean | Whether to receive marketing messages via email. |
unsubscribeEmail | (optional) boolean | Whether to receive marketing messages via texting (SMS, LMS) |
const user = {
"id": ID,
"memberId": MEMBER_ID,
"name": NAME,
"avatarUrl": AVATAR_URL,
"alert": ALERT_COUNT,
"unread": UNREAD_COUNT,
"profile": {
"name": PROFILE_NAME,
"mobileNumber": "+~~~",
"CUSTOM_VALUE_1": "VALUE_1",
"CUSTOM_VALUE_2": "VALUE_2"
}
"unsubscribeEmail": BOOLEAN,}
"unsubscribeTexting": BOOLEAN,
"tags": ["1", "2", "3"],
"language": LANGUAGE
}
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. |
const popupData = {
"chatId": CHAT_ID,
"avatarUrl": AVATAR_URL,
"name": NAME,
"message": MESSAGE,
}
UserData
A model used for data configuration on updateUser
.
field | type | description |
---|---|---|
language | Language | A user’s language. |
tags | (optional) string | A user’s tag list. Overwrite with tag data you add. The maximum number is ten and is not case-sensitive. |
profile | (optional) object | A user’s profile. Overwrite with profile data you add. Initialize if you set the profile value to nil. |
profileOnce | (optional) object | A profile to add to the user. Add a new profile value it it does not exist. |
unsubscribeEmail | (optional) boolean | Whether to receive marketing messages via email. |
unsubscribeTexting | (optional) boolean | Whether to receive marketing messages via email. |
const user = {
"language": LANGUAGE, // "ko", "jp", "en"
"tags": ["1", "2", "3"],
"profile": {
"name": NAME,
"email": EMAIL,
"mobileNumber": '+~~~',
"avatarUrl": AVATAR_URL,
OTHER_KEY: OTHER_VALUE,
},
"profileOnce": {
},
"unsubscribeEmail": BOOLEAN,
"unsubscribeTexting": BOOLEAN,
};
ChannelIO.updateUser(user).then((result) => {
// result.error
// result.user
});
Appearance
An enum object for the appearance of the SDK.
// Set appearance to System
"appearance" : "system"
// Set appearance to Light
"appearance" : "light"
// Set appearance to Dark
"appearance" : "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 | The server responded with 4xx status code. |
unknown | An unknown error. |
"SUCCESS"
"NOT_INITIALIZED"
"NETWORK_TIMEOUT"
"NOT_AVAILABLE_VERSION"
"SERVICE_UNDER_CONSTRUCTION"
"REQUIRE_PAYMENT"
"ACCESS_DENIED"
"UNKNOWN_ERROR"
Updated 10 months ago