Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

In the below example, we will use an utterance to invoke the login directive.the flow studio and prompt the user to login to continue chatting with the chatbot.

Flow studio

We will create a flow studio flow and add a custom control followed by a single input node at the beginning of the flow (as shown below) to prompt the user to login.

...

Then we add an Evaluate node to check if the user logged in successfully.
If true, the flow continues
If anything else, the flow ends with an authentication error message.

...

Experience Designer

Use the below code in a function node to enable login directive as shown below.

...

Code Block
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?'
}]; 

return msg;

You have to set a session variable to know if a user successfully logged in. Use the below code in the function node.

Code Block
msg.orbita.session.isLogin = true;
return msg;
Attachments
previewfalse
oldfalse
patterns.*json
Filter by label (Content by label)
showLabelsfalse
max5
spacescom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@130ff
showSpacefalse
sortmodified
typepage
reversetrue
labelsdirective
cqllabel = "directive" and type = "page" and space = "OCS"