Configuring Ebbot Flutter UI is done by passing a EbbotConfiguration
instance to the the EbbotFlutterUi
widget.
The Ebbot Flutter UI widget has the following configuration options:
change the underlying theme in flyer-chat
passing user specific attributes
setting the cloud environment the App is running against
adding a callback handler for certain events
controlling certain parts of the application through an api controller
As Ebbot Flutter UI is using the flyer-chat
component under the hood, styling it is done by configure a theme and passing it in the configuration builder like so:
Consult the flyer-chat
themeing guide for more in depth information on how to style the chat widget.
To feed the bot with more context about the user, you can pass user attributes in the configuration file, the allowed type is Map<String, dynamic>
:
Configuring the cloud environment is done by passing a configuration property to the environment
builder function.
Available configuration options are:
To configure what should happen when enter on the keyboard has been pressed, you can pass the following options:
Sometimes, it is useful to know what is happening in the widget and when it is happening. To address this, you can pass a callback object when configuring the app:
In order to communciate with the widget, you can pass an instance of an API controller:
[!IMPORTANT] The API controller can only be called once the widget has been fully loaded, which is known when
onLoad
callback has been invoked or by calling theisInitialized
method.
The following is a full fledged example with all configurable options passed to the widget:
Environment | Configuration Host | Chat API Host |
---|---|---|
Enum Value | Description |
---|---|
Method | Description | Parameters |
---|---|---|
Method | Description | Parameters |
---|---|---|
Environment.staging
https://ebbot-staging.storage.googleapis.com
(https/wss)://staging.ebbot.app/api/asyngular
Environment.release
https://ebbot-release.storage.googleapis.com
(https/wss)://release.ebbot.app/api/asyngular
Environment.googleCanadaProduction
https://ebbot-ca.storage.googleapis.com
(https/wss)://ca.ebbot.app/api/asyngular
Environment.googleEUProduction
https://ebbot-v2.storage.googleapis.com
(https/wss)://v2.ebbot.app/api/asyngular
Environment.ovhEUProduction
https://storage.gra.cloud.ovh.net
(https/wss)://ebbot.eu/api/asyngular
EbbotBehaviourInputEnterPressed.sendMessage
Indicates that pressing enter sends a message.
EbbotBehaviourInputEnterPressed.newline
Indicates that pressing enter inserts a new line.
onLoadError
Called when there is an error during the widget loading process.
error
: An EbbotLoadError
object containing details about the error.
onLoad
Called when the widget has successfully loaded.
No parameters.
onRestartConversation
Called when the conversation is restarted.
No parameters.
onEndConversation
Called when a conversation ends.
No parameters.
onMessage
Called when a general message is received.
message
: A string containing the message received.
onBotMessage
Called when a message from the bot is received.
message
: A string containing the bot's message.
onUserMessage
Called when a message from the user is received.
message
: A string containing the user's message.
onStartConversation
Called when a new conversation starts.
No parameters.
isInitialized
Checks if the widget is initialized.
No parameters. Returns bool
.
restartConversation
Restarts the conversation.
No parameters.
endConversation
Ends the current conversation.
No parameters.
sendMessage
Sends a message to the conversation.
message
: A String
containing the message to be sent.
setUserAttributes
Sets attributes for the user in the conversation.
attributes
: A Map<String, dynamic>
containing the attributes to be set for the user.
triggerScenario
Triggers a specific scenario in the conversation.
scenarioId
: A String
identifying the scenario to be triggered.