Skip to content

Commit

Permalink
Begin adding section on Transform Reply Variables
Browse files Browse the repository at this point in the history
  • Loading branch information
wallslide committed Aug 28, 2020
1 parent c3177df commit 6a21ee7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion docs/development/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,17 @@ The `override` and `overrideCurrent` props that are passed to the `ChatMode` are

Standard nodes appear on the left-side of the chat as if they are coming from the 'bot'. Reply nodes are shown on the right-side of the chat as coming from the user of the application.

If information other than text such as video, images, or complex or dynamic visualizations needs to be displayed as coming from a bot, then creating a custom widget for a Standard Node is appropriate. Similarly, if a user is replying to the bot in a form that can't easily be represented as text, or is stored as an object or other encoded data, then a custom Reply Node widget is appropriate for visualizing their reply.
If information other than text such as video, images, or complex or dynamic visualizations needs to be displayed as coming from a bot, then creating a custom widget for a Standard Node is appropriate.

If a user is replying to the bot in a form that can't easily be represented as text, then a custom widget for a reply node is appropriate. If the value of a variable is encoded, and needs to be decoded or specially formatted as text, then consider using a `transformReplyVariables` function hook instead.

The a Reply Node's widget will receive almost identical props as the original Standard Node that the reply is in response to. The only differences being that the top-level `reply` property will be `true` instead of `undefined`, and the Node's `event.value` will store the reply value passed to `upilCore`.

### Transform Reply Variables

The `transformReplyVariables` function hook allows the developer to transform a variable's value before it's displayed as a reply from a user. The return value must be formatted as text. If more advanced visualization methods are required, consider using a custom widget to replace the built-in text-based reply instead.


### Override function signature

```js
Expand Down

0 comments on commit 6a21ee7

Please sign in to comment.