Conversation

Conversation #

AIHelp provides you with robot and manual conversation ways.

By default, we show users robot customer service and answer users’ questions through robot story line.

If the robot fails to completely solve the user’s doubts, the user can submit a manual customer complaint with forms. When the user enters AIHelp conversation system next time, SDK will automatically jump to the ongoing customer complaint session.

Of course, you can also custom your configuration as you wish, such as displaying different welcome messages for different levels of users, opening manual conversation directly for VIP users, etc.

API #

You can call this function to display AIHelp conversation system.

This API requires the following parameters:

  • ConversationConfig

    Optional. Custom configuration for AIHelp conversation system.

    Field Description Type
    conversationIntent intent for conversation display ConversationIntent(BOT / HUMAN)
    alwaysShowHumanSupportButtonInBotPage entrance visiblity for human support button boolean(true / false)
    welcomeMessage custom welcome messag for human support String(custom string)
    storyNode entrance node for specific story line String(story lines’ user say)

Note:

For HTML5 platform, you need to set the above API name as the supportMode, and encapsulate all your needed fields into supportConfig and pass in. You can get more details in following code examples and here.

Code example #

Let’s assume a scenario where the application has different support and care schemes for different levels of users.

The details are as follows:

1、For users whose level < 20, show robot customer service to them by defalut, they can only submit customer complaints through story lines and forms, which is the default situation of AIHelp conversation system;

2、For users whose level is between 50 and 100, show robot customer service to them, but these users can choose to contact manual customer service with entrence in the top-right corner;

3、For users with level > 100, show manual customer service to them directly, while displaying a special welcome message different from other users.

Then, the code example for this scenario is as follows:

Unlike other platforms, you also need to pass in the activity reference when calling this API.

public void showConversation(int level) {
    ConversationConfig.Builder conversationBuilder = new ConversationConfig.Builder();
    if (level > 50 && level < 100) {
        conversationBuilder.setAlwaysShowHumanSupportButtonInBotPage(true);
    } else if (level > 100) {
        conversationBuilder.setConversationIntent(ConversationIntent.HUMAN_SUPPORT);
        conversationBuilder.setWelcomeMessage("THIS IS YOUR SPECIAL WELCOME MESSAGE");
    }
    AIHelpSupport.showConversation(conversationBuilder.build());
}
- (void)showConversation:(int)level {
    AIHelpConversationConfigBuilder *conversationBuilder = [[AIHelpConversationConfigBuilder alloc] init];
    if (level > 50 && level < 100) {
        conversationBuilder.alwaysShowHumanSupportButtonInBotPage = YES;
    }else if (level > 100) {
        conversationBuilder.conversationIntent = AIHelpSupportIntentConversation;
        conversationBuilder.welcomeMessage = @"THIS IS YOUR SPECIAL WELCOME MESSAGE";
    }
    [AIHelpSupportSDK showConversation:conversationBuilder.build];
}
public void showConversation(int level) 
{
    ConversationConfigBuilder conversationBuilder = ConversationConfigBuilder();
    if (level > 50 && level < 100) 
    {
        conversationBuilder.setAlwaysShowHumanSupportButtonInBotPage(true);
    } 
  	else if (level > 100) 
    {
        conversationBuilder.setConversationIntent(HUMAN_SUPPORT);
        conversationBuilder.setWelcomeMessage("THIS IS YOUR SPECIAL WELCOME MESSAGE");
    }
    AIHelpSupport::showConversation(conversationBuilder.build());
}
public void showConversation(int level) 
{
    ConversationConfig.Builder conversationBuilder = new ConversationConfig.Builder();
    if (level > 50 && level < 100) 
    {
        conversationBuilder.setAlwaysShowHumanSupportButtonInBotPage(true);
    } 
  	else if (level > 100) 
    {
        conversationBuilder.setConversationIntent(ConversationIntent.HUMAN_SUPPORT);
        conversationBuilder.setWelcomeMessage("THIS IS YOUR SPECIAL WELCOME MESSAGE");
    }
    AIHelpSupport.showConversation(conversationBuilder.build());
}
<script src="https://aihelp.net/webchat/aihelp.js"></script>
<script>
    // Example for showConversation case
    (function () {
        var conversationConfig = {};
        if (level > 20 && level < 50) {
            conversationConfig['alwaysShowHumanSupportButtonInBotPage'] = true;
        } else if (level > 50) {
            conversationConfig['conversationIntent'] = 2; // 2 for manual support
            conversationConfig['welcomeMessage'] = 'THIS IS YOUR SPECIAL WELCOME MESSAGE';
        }
        var initConfig = {
            appKey: 'THIS IS YOUR APP KEY',
            domain: 'THIS IS YOUR APP DOMAIN',
            appId: 'THIS IS YOUR APP ID',
            appName: "THIS IS YOUR APP NAME",
            language: 'THIS IS YOUR DEFAULT LANGUAGE(OPTIONAL)',
            supportMode: 'showConversation',
            supportConfig: conversationConfig,
            userConfig: {userId: "", customData: {}}
        }
        if (typeof AIHelpSupport !== undefined) AIHelpSupport.init(initConfig);
    })();
  	function openAIHelp() {
        if (typeof AIHelpSupport !== undefined) AIHelpSupport.show();
    }
</script>

Page example #

Page examples based on the above scenario are as follows: