These are actions that a Flock client takes when a user interacts with a control (e.g. buttons, slash commands, etc.) provided by your app.
Flock supports three kinds of client actions:
Typically you setup a client action by providing a ClientActionConfig object while configuring a button or a slash command, either in the app manifest or in an attachment.
A client action can also be triggered by a widget using methods provided in flock.js, or by FlockML content using anchor tags.
Which client action is performed depends on the type
attribute of this object:
open_widget
– opens a widgetopen_browser
– opens the system browserdispatch_event
– sends an event to the app backendSee the relevant section in the widgets page.
Open the system browser by providing a ClientActionConfig object with type open_browser
and the following attributes:
url
– the URL to opensend_context
– whether to append Flock specific query parameters (like flock_user_token
, flock_event
, etc.) to the URL or not. The default value is false
. Never set this to true
if you are opening a third party URL in the browser.For example, to open the browser anytime a user presses the attachment picker button, provide this configuration:
attachment_picker: { description: "<attachment picker help text>", icon: "attachment-picker.png", action: { type: "open_browser", url: "<url>", send_context: true } } |
Send an event to your app backend by providing a ClientActionConfig object with the type dispatch_event
.
Which event is sent to your app backend is covered in the next section.
For example, to dispatch an event when user enters a slash command, provide this configuration:
slash_command: { command: "<name of the command>", help_text: "<help text for the slash command>", action: { type: "dispatch_event" } } |
An event is generated anytime a client action is triggered. The event alongwith its attributes is
flock_event
and flock_event_attributes
to the widget or browser URLThe table below explains what event is generated for each trigger:
Trigger | Event |
---|---|
Button | client.press_button |
Slash command | client.slash_command |
Widget | client.widget_action |
FlockML | client.flockml_action |
The event name alongwith its attribute should provide sufficient context for the client action.
Yes, there are a couple of scenarios in which a Flock client might trigger one for a user who hasn't installed the app
In case the configured action is to open a widget or the browser, the Flock client allows it, however no user token is passed. See this section in the widgets page for more details.
In the configured action is to dispatch an event to the app backend, the Flock client doesn't allow it, and instead prompts the user to install your app.