ChannelIO

boot

Boot up channel plugin(button) to make it ready to use

parametertypedescription
optionobjecta Boot Option object contains informations to initialize Channel IO plugin
callbackFunction(optional)a callback function which will be called after boot.
ChannelIO('boot', {
  pluginKey: 'YOUR_PLUGIN_KEY'
}, function onBoot(error, user) {
  if (error) {
    console.error(error);
  } else {
    console.log('boot success', user)
  }
});

shutdown

Shutdown channel plugin

ChannelIO('shutdown');

showMessenger

Show plugin messenger

ChannelIO('showMessenger');

show

Show plugin messenger

🚧

show will be supported until 2022. After that time it will be deprecated.

NOTE: Recommend to use showMessenger instead.

ChannelIO('show');

hideMessenger

Hide plugin messenger

ChannelIO('hideMessenger');

hide

Hide plugin messenger

🚧

hide will be supported until 2022. After that time it will be deprecated.

NOTE: Recommend to use hideMessenger instead.

ChannelIO('hide');

lounge

Go to the lounge view.

🚧

lounge will be supported until 2022. After that time it will be deprecated.

NOTE: lounge API won't work in all mobile environments.

ChannelIO('lounge');

openChat

Open a chat with the given chat id and message. If the given chat id exists, appropriate chat will be opened. If not, lounge will be opened. In this case, the message will be ignored. If chat id is empty and message is given, new chat will be opened and the given message will be put in the input box. In this case, if the support bot is enable, support bot will run. if chat id and message is both empty, new chat will be opened.

ChannelIO('openChat', chatId: string | number, message: string);
parametertypedescription
chatIdstring or number(optional)The id of the chat
messagestring(optional)The message which will be put in the input box on messenger when new chat is opened
ChannelIO('openChat', 132); // If chat id 132 is exists, that chat will be opened. If not, lounge will be opened.

ChannelIO('openChat', undefined, 'something'); // New chat will be opened and 'something' will be put in the input box. In this case, if the support bot is enable, support bot will run.
ChannelIO('openChat', '132'); // If chat id 132 is exists, that chat will be opened. If not, lounge will be opened.

ChannelIO('openChat', undefined, 'something'); // New chat will be opened and 'something' will be put in the input box. In this case, if the support bot is enable, support bot will run.

track

Track an event

ChannelIO('track', eventName: string, eventProperty: object);
parametertypedescription
eventNamestringname of event, its length should be less than 30
eventPropertyobjectan object contains key/value information
ChannelIO('track', 'OrderRequest');
ChannelIO('track', 'Order', {
  "price": 100,
  "currency": 'USD'
});

onBoot

Register a callback function when boot was completed. Returns a user if boot was succeeded. user is undefined when boot failed.

🚧

onBoot will be supported until 2022. After that time it will be deprecated

NOTE: Recommend to use boot callback instead.

ChannelIO('onBoot', function(user) {
  // YOUR CODE...
});

onShowMessenger

Register a callback function when the chat list is shown.

🚧

onShowMessenger API won't work in all mobile environments

NOTE: onShowMessenger API won't work in all mobile environments.

ChannelIO('onShowMessenger', function() {
  // YOUR CODE...
});

onShow

Register a callback function when the chat list is shown.

🚧

onShow will be supported until 2022. After that time it will be deprecated

NOTE: Recommend to use onShowMessenger instead.
onShow API won't work in all mobile environments.

ChannelIO('onShow', function() {
  // YOUR CODE...
});

onHideMessenger

Register a callback function when the chat list is hidden.

🚧

onHideMessenger API won't work in all mobile environments

NOTE: onHideMessenger API won't work in all mobile environments.

ChannelIO('onHideMessenger', function() {
  // YOUR CODE...
});

onHide

Register a callback function when the chat list is hidden.

🚧

onHide will be supported until 2022. After that time it will be deprecated

NOTE: Recommend to use onHideMessenger instead.
onHide API won't work in all mobile environments.

ChannelIO('onHide', function() {
  // YOUR CODE...
});

onBadgeChanged

Register a callback when unreadCount is changed.

ChannelIO('onBadgeChanged', function(unreadCount) {
  // YOUR CODE...
});

onChangeBadge

Register a callback when unreadCount is changed.

🚧

onChangeBadge will be supported until 2022. After that time it will be deprecated

NOTE: Recommend to use onBadgeChanged instead.

ChannelIO('onChangeBadge', function(unreadCount) {
  // YOUR CODE...
});

onChatCreated

Register a callback when a user success to create a chat.

🚧

onChatCreated API won't work in all mobile environments

NOTE: onChatCreated API won't work in all mobile environments

ChannelIO('onChatCreated', function() {
  // YOUR CODE...
});

onCreateChat

Register a callback when a user success to create a chat.

🚧

onCreateChat will be supported until 2022. After that time it will be deprecated

NOTE: Recommend to use onChatCreated instead.
onCreateChat API won't work in all mobile environments

ChannelIO('onCreateChat', function() {
  // YOUR CODE...
});

onProfileChanged

Register a callback when a user success to change their profile in the settings page and chats.
profile is an object of the user's profile.

🚧

onProfileChanged API won't work in all mobile environments

NOTE: onProfileChanged API won't work in all mobile environments

ChannelIO('onProfileChanged', function(profile) {
  // YOUR CODE...
});

onChangeProfile

Register a callback when a user success to change their profile in the settings page and chats.
profile is an object of the user's profile.

🚧

onChangeProfile will be supported until 2022. After that time it will be deprecated

NOTE: Recommend to use onProfileChanged instead.
onChangeProfile API won't work in all mobile environments

ChannelIO('onChangeProfile', function(profile) {
  // YOUR CODE...
});

onUrlClicked

Register a callback when a user clicks redirect images or buttons.
We pass the redirect url to a function.

ChannelIO('onUrlClicked', function(url) {
  // YOUR CODE...
});

onClickRedirect

Register a callback when a user clicks redirect images or buttons.
We pass the redirect url to a function.

🚧

onClickRedirect will be supported until 2022. After that time it will be deprecated

NOTE: Recommend to use onUrlClicked instead.

ChannelIO('onClickRedirect', function(url) {
  // YOUR CODE...
});

clearCallbacks

Clear all callbacks registered.

ChannelIO('clearCallbacks');

updateUser

Update user information.

fieldtypedescription
languagestringSet user's language. When language is 'ko' or 'ja', interface is change to these languages. Else case, interface language is set to english. When set invalid language, user's language field is set to null
tagsarrayTags to overwrite. Max 10 tags are allowed. Set null to reset. Empty list is not allowed.
profileobjectProfile map to overwrite. Set null to reset. Set null for profile value to reset profile value. Empty map is not allowed. Always lower case.
profileOnceobjectMap of profile to be added if there is no each profile values.
unsubscribedbooleanTerminates the user's marketing subscription. If the existing value is true, the value of true is maintained even if you change it to the value of false.
ChannelIO('updateUser', {
  language: 'ko',
  tags: ['a', 'b'], // replace
  profile: {
    email: '[email protected]',
    mobileNumber: '+18004424000',
    name: 'name',
  },
  profileOnce: {
    email: '[email protected]',
    mobileNumber: '+18004424000',
    name: 'name',
  },
  unsubscribed: true
}, function onUpdateUser(error, user) {
  if (error) {
    console.error(error)
  } else {
    console.log('updateUser success', user)
  }
})

addTags

Add tags.

parametertypedescription
arrayarrayTags to be added. Duplicate values are maintained. Combined tag list cannot exceed 10. Null or empty list is not allowed. Always lower case.
ChannelIO('addTags', ['tag1', 'tag2', ..], function onAddTags(error, user) {
  if (error) {
    console.error(error)
  } else {
    console.log('addTags success', user)
  }
})

removeTags

Remove tags.

parametertypedescription
arrayarrayTags to be erased. If there is no match tag value, it is ignored. Null or empty list is not allowed.
ChannelIO('removeTags', ['tag1', 'tag2', ..], function onRemoveTags(error, user) {
  if (error) {
    console.error(error)
  } else {
    console.log('removeTags success', user)
  }
})

setPage

Set page to be used instead of canonical url .

setPage with null or undefined is different from resetPage. (that will send page data with null)

parametertypedescription
pagepagePage data to replace default page value
ChannelIO('setPage', page)

resetPage

Reset page data customized by developer.

If you call resetPage, page data will fill with canonical url .

ChannelIO('resetPage')

showChannelButton

Show channel button.

ChannelIO('showChannelButton');

hideChannelButton

Hide channel button.

ChannelIO('hideChannelButton');