In Slack it’s possible to trigger modal dialogs on the chat client. Dialogs supports three field types: text
, textarea
and select
and can only be initiated by click on a button.
A dialog flow must implement 3 steps
Example dialog node
Open Dialog
button in a Inline button node
or Generic Template node
. Specify Modal id if there are several dialog formsOpen Dialog
button, a message type dialog
is triggered from the Slack Receiver node
, the content of the payload is the Modal id specified in the button. At this point the chat flow should answer with a Dialog node
which defines the modal fields. Use the Switch node
to redirect incoming messages based on type.response
is triggered from the Slack Receiver node
, and contains the response hash (key is the name of the field, value is the answer). In order to extract the hash from the response
message use a Parse node
using the Dialog response type. Use the Switch node
to redirect the response
message to the proper Parse node
.After the parse node the message.payload
will contain
{
my_text_field: 'test',
my_textarea_field: 'sadasda',
my_select_field: 'one'
}
Name | Type | Description |
---|---|---|
title | string | The title of the modal dialog. Required |
submitLabel | string | The label of the submit button |
messageId | string | The message id to modify, leave blank for a new message |
elements | array of elements | The elements of the modal form. Required |
The element
structure
Name | Type | Description |
---|---|---|
type | string | Type of element: text, textarea, select. Required |
label | string | The label form element. Required |
name | string | The name of the element, also used in hash result. Required |
value | string | The initial value of the element |
placeholder | string | Placeholder text of the form element |
hint | string | Little help below the form element |
optional | boolean | If the form element is optional, if not specified is mandatory |
subtype | string | Sub-type for text and textarea elements: email, number, tel, url |
minLength | number | Minimum length for text and textarea elements |
maxLength | number | Maximum length for text and textarea elements |
options | array of option | Options of the combo box for select elements |
The option
structure
Name | Type | Description |
---|---|---|
value | string | The value of the option. Required |
label | string | The label of the option. Required |