What are client actions?
Flock currently supports three kinds of client actions. They are:
- Opening a widget inside the Flock client
- Opening a URL in the system browser;
- Sending an event to the event listener URL.
Opening a Widget
You can use widgets to render web applications inside an iframe or a webview within Flock. They can not only do everything that a normal webapp can, but also interact with the Flock client hosting them.
To open a widget, the following info is required:
- URL of the widget
- Type of widget in desktop – it can be either
- Type of widget in mobile – this is usually optional. The only acceptable value is
Opening the Browser
You can also choose to open a URL in the browser. To open the browser, provide the following:
- The URL to open.
- Whether to send event context or not. When enabled, event parameters are appended to the URL.
Sending an event to the event listener URL
Or if you prefer to remain silent, you can send an event to the event listener URL.
What happens when a client action is triggered?
An event is generated every time a client action is triggered.
- If the configured action is to open a widget or browser URL, the event is appended as a query parameter to the URL.
- Or if the configured action is to send the event to the event listener URL, it is sent to the app service URL.
The events sent by various controls when a client action is triggered are listed below:
The event name along with its attribute provides sufficient context for the client action.
How do I configure a client action?
There are multiple ways to configure client actions in Flock, all of which are described below.
Use the developer dashboard to configure an action for a Slash Command, Launcher Button, Chat Tab Button or Attachment Picker. Once you have enabled the control, you can select the appropriate action and provide any additional info that's required.
Widgets can open another widget or the browser using flock.js.
Can client actions be triggered for users who haven't installed the app?
Yes. Your app may send a message to a user who may not have installed your app, or a group where some users may not have installed your app. When these users interact with this message's attachment (e.g. click on an attachment button, or take some action inside the attachment widget), a client action is triggered.
If you verify that the event token sent with the corresponding event is really signed using your app's secret (you should always do this anyways), you can be certain that the event originated from Flock and was actually triggered by the user whose userId is included in the event token (even if they haven't installed the app).