Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

The login directive enables the admin users to add a login button to your chatbot flow. The button click redirects the user to Orbita’s user login page in a new tab. If the user successfully logs in, the login tab closes automatically.

In the below example, invoking login intent will enable the login directive in the chatbot.

Create Intents

You can create intents from the Project Side navigation menu > Create > Intent Library.

In this example, we have used two intents Login and Loginsuccess.

Login Intent

In this example, the Login intent is used to invoke the Login Directive.

Loginsuccess Intent

In this example, the Loginsuccess intent is triggered after the user logs in successfully.

This intent should contain success as one of its utterances.

Experience Designer

In the Experience Designer, design a flow as shown below.

Use the below code in the function node to use the login directive.

if(!msg.payload.orbita) {
    msg.payload.orbita = {};
}

if(!msg.payload.orbita.directive) {
    msg.payload.orbita.directive = [];
}

msg.payload.orbita.directive.push({
    type: 'login', 
    successUtterance: 'success', 
    html: `<button class="smrtBtn chattheme chatthemeborderbuttons">Login</button>`
})
// msg.payload.logoutUrls = [{
//     'type': 'window', 
//     url:'http://localhost:3030/oauth/logout?'
// }]; 
msg.payload.orbita.state = "Login"

return msg;

How to get inline login

You can make use of the HTML directive to get inline login in the Chatbot. See, HTML Directive

You should know the login page URL of your instance.

Use the login directive and click the login button. Copy the URL of the login tab (opens in a new tab) and place it in the URL property in the code below.

Place this sample code in a function node and connect it as shown in the screenshot.

Sample code

if(!msg.payload.orbita) {
msg.payload.orbita = {};
}
if(!msg.payload.orbita.directive) {
msg.payload.orbita.directive = [];
}

msg.payload.orbita.directive = [{
    type: "html5",
    options: {
        template: '450x500',
        url :"<Login page URL of your Instance>"
    },
    loginSuccessUtterance: 'success'
}]

msg.payload.orbita.state = "Login"

return msg;

You can use successUtterance: 'success' or loginSuccessUtterance: 'success', to invoke the Intent after the HTML content (Login page) is rendered.

The Login Directive and the Inline Login are combined in a single flow in the below attachment.

  File Modified
No files shared here yet.

  • No labels