-
Notifications
You must be signed in to change notification settings - Fork 22
Xatkit React Platform
Gwendal Daniel edited this page Jan 14, 2020
·
13 revisions
Receive and send messages from our React-based chat component. This platform is bundled with the Xatkit release.
The React platform is a concrete implementation of the ChatPlatform.
The React platform defines the following providers:
Provider | Type | Context Parameters | Description |
---|---|---|---|
ChatProvider | Intent | - chat.channel : the identifier of the channel that sent the message- chat.username : the name of the user that sent the message- chat.rawMessage : the raw message sent by the user (before NLP processing) |
Receive messages from a communication channel and translate them into Xatkit-compatible intents (inherited from ChatPlatform) |
ReactIntentProvider | Intent | - react.channel : the identifier of the react channel that sent the message- react.username : the name of the react user that sent the message- react.rawMessage : the raw message sent by the user (before NLP processing) |
Receive messages from the react component and translates them into Xatkit-compatible intents. Note that react.channel , react.username , and react.rawMessage contain the same values as chat.channel , chat.username , and chat.rawMessage
|
ReactEventProvider | Event | - | Receive non-textual events from the react component and translates them into Xatkit-compatible events. |
Event | Context | Parameters | Description |
---|---|---|---|
Client_Ready | react |
- channel (String): the identifier of the react channel associated to the new client |
Event sent when a new react client connects to the Xatkit. Note: this event sets the context parameter react.channel , allowing to use a Reply action to post a message in response. |
Client_Closed | react |
- channel (String): the identifier of the react channel associated to the closed client |
Event sent when a react client disconnects from Xatkit. Note: this event sets the context parameter react.channel , but does not ensure that a Reply action invocation as a response to this event will be successful. |
Action | Parameters | Return | Return Type | Description |
---|---|---|---|---|
PostMessage | - message (String): the message to post- channel (String): the identfier of the react channel to post the message to |
The posted message | String | Posts the provided message to the given react channel (inherited from ChatPlatform) |
Reply | - message (String): the message to post as a reply |
The posted message | String | Posts the provided message as a reply to a received message (inherited from ChatPlatform) |
ItemizeList | - list (List): the list to itemize |
A String presenting the provided list as a set of items |
String | Creates a set of items from the provided list . This actions relies on Object.toString() to print each item's content |
ItemizeList | - list (List): the list to itemize- formatter (Formatter the formatter used to print each item |
A String presenting the provided list as a set of items formatted with the given formatter
|
String | Creates a set of items from the provided list . This action relies on the provided formatter to print each item's content |
EnumerateList | - list (List): the list to enumerate |
A String presenting the provided list as an enumeration |
String | Creates an enumeration from the provided list . This actions relies on Object.toString() to print each item's content |
EnumerateList | - list (List): the list to enumerate- formatter (Formatter the formatter used to print each item |
A String presenting the provided list as an enumeration formatted with the given formatter
|
String | Creates an enumeration from the provided list . This action relies on the provided formatter to print each item's content |
The React platform supports the following configuration options
Key | Values | Description | Constraint |
---|---|---|---|
xatkit.react.client.url |
String | The base URL of the website displaying the react chat component. Supports wildcard ("*" ) to allow any domain. |
Optional (default to <xatkit.server.public_url>:<xatkit.server.port> ) |
xatkit.react.port |
Integer | The port used to start the socket server used by the React platform. |
Optional (default 5001 ) |
xatkit.react.public_url |
String | The public URL of the socket.io server. This property is used in the generated HTML page accessible at /admin , and allows to specify a custom location for the react server. |
Optional (default http://localhost:5001 ) |
xatkit.react.enable_testing_page |
Boolean | Enables/disables the testing page located at /admin . |
Optional (default true ) |
Note: if the react platform is used as a concrete implementation of the ChatPlatform the following property must be set in the Xatkit configuration:
xatkit.platforms.abstract.ChatPlatform = com.xatkit.plugins.react.platform.ReactPlatform
- Getting Started
- Configuring your bot
- Integrating an Intent Recognition Provider
- Adding a bot to your website
- Deploying on Slack
- Basic concepts
- Intents and Entities
- States, Transitions, and Context
- Default and Local Fallbacks
- Core Library