Versions Compared

Key

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

...

The hook function in Bot v3 allows us to publish messages to the chatbot dynamically from outside the Bot. The hook function's available keys are detailed below.

Key

Snippet Syntax

Description

Sample

send_message

OrbitaChatBotV3.hook('send_Message', {value}, {payload})

This is used to send information to the Bot. The value passed is treated as both the value and data. The payload value is of type object string and value payload is of type string object

Sample: Passing user utterance to the Bot from the page in button click action/ page redirection.

OrbitaChatBotV3.hook("send_message", command);
Or
OrbitaChatBotV3.hook("send_message", '', command);

send_advancedMessage

OrbitaChatBotV3.hook('send_advancedMessage', {value}, {payload}, {data})

This is used to send information to the Bot.

data value is of type object string, value payload is of type string object, payload data is of type object

Sample: Passing a user friendly utterance to the Bot for display but also send complex data to the backend for business logic handling.

OrbitaChatBotV3.hook('send_advancedMessage', "",
{eventName: "Submit_Details"},
{name: 'PatientName', id: 1100 }
);

connect

OrbitaChatBotV3.hook('connect','', {payload})

This re-establishes a socket connection. Send the payload object as it is required (it can also be empty here).

OrbitaChatBotV3.hook('connect','', payload);
Or
OrbitaChatBotV3.hook('connect');

triggerEvent

OrbitaChatBotV3.hook('triggerEvent', '', {payload})

This allows to trigger an Event. The Event name is passed inside the payload object.

OrbitaChatBotV3.hook('triggerEvent', "",
{eventName: "Schedule_Appointment" }
);

disconnect

OrbitaChatBotV3.hook('disconnect','', {payload})

The socket connection will be disconnected. Send the payload object as it is required (it can also be empty here).

OrbitaChatBotV3.hook('disconnect','', payload);
Or
OrbitaChatBotV3.hook('disconnect');