Versions Compared

Key

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

...

Table of Contents
excludeRelated Articles

Directives that render information to the client

When the client invokes a flow that contains this kind of directives, the server will send the relevant information to the client and no further communication will happen.

...

HTML5

The HTML directive shows an HTML string or URL content within the chat bubble. If the directive object type is html5, then the server will render.

...

The Output of “Options – url”.

...

Logout

When the client invokes the logout directive, the server responds with a popup window with a custom message.

...

Code Block
msg.payload.orbita.directive = 
  [{
     type    : "logout",
     title   : "Session logOut",
     options : {message: "You are logged out"}
  }];
return msg;

Directives that request information from the client and then render information

When the client invokes a flow that contains this kind of directive, the server responds by asking for input from the client. After the input from the client is received, the server stores the information and responds with a success or failure message.

...

Audio Recorder

If the type of the directive object is audiorecording, the Audio Recorder widget is rendered. It is a floating widget.

...

The success response from the audio upload contains the URL of the recorded audio.

Transcribe

If the type of the directive object is transcribe, the Transcribe widget is rendered. It is a floating widget.

...

After the conversion from speech to text is stopped, you can delete or upload the transcribed file using the Stop or upload buttons.

...

Date Picker

The Date picker directive lets you pick the date.

...

Click the calendar icon to open the Date picker widget.

...

Time Picker

The Time picker directive lets you pick the Time.

...

Select the hours or minutes or am/pm and use the up/down arrows to change.

Date and Time Picker

The Date and Time picker directive lets you pick the date and time simultaneously.

...

Select the hours or minutes or am/pm and use the up/down arrows to change. You can also choose Today’s date.

Reminder Directive

As an admin user, If the chatbot user does not reply for more than a predefined time, then you would like to remind the user that the bot is awaiting a response from the user. Reminder Directive is available to exactly fit this use case.

...

Code Block
var reminderDirective = {
    "directive" : [
       {
         "type"    : "reminder",
         "options" : {
           "waitTime" : "8000",
           "text"     : "select any city name",
           "buttons"  : {
             "name"    : "buttons",
             "type"    : "buttons",
             "choices" : [
               {
                 "text": "Mumbai", value: "Mumbai"
               },
               {
                 "text": "Delhi", value: "Delhi"
               }
                         ]
                       }
                     }
       }
  ]
}
msg.payload.orbita = reminderDirective;
return msg;

Required parameters

type

The type field should be “reminder

waitTime

The waitTime is the time, the chatbot will wait, before sending the reminder message.

text

The text is the reminder message.

...

Note: If the response already contains buttons and if you don’t provide the buttons property in the directive, then the chatbot will recall the buttons from the current response.

...

Optional Parameters

buttons

If you want custom buttons in the reminder directive, you can make use of buttons property. This is an optional field.

When you place the custom buttons in the reminder directive, it will override the buttons from the current response.

...

Validating directives in Postman

  1. Login to Postman.

  2. Select the method - POST.

  3. Place the login endpoint in the space provided.

  4. In the Body tab, paste the login credentials as input and click Send.

    Code Block
    {
      “password” : “XXXXXXX”,
      “username” : “XXXXXXXX”
    }
  5. If successful, you will receive a token.

  6. Switch to the Headers tab, and paste the token that you obtained from the earlier step.

  7. Provide the endpoint URL of your chatbot.

  8. Click Send.

  9. In the Body tab, Paste the code below to test the directive and click Send.

...

Code Block
{
  "audio"          : 0, 
  "recognizedText" : "help",
  "utterance"      : "transcribe directive",
  "sessionId"      : "yzmTkldt1UehLIC3"
}

...

Example flow

The following image shows an example flow that triggers the directives when invoked with the respective intents.

...

Related Articles

Filter by label (Content by label)
showLabelsfalse
max5
showSpacefalse
cqllabel = "directive"