Clockify uses the window message API in order to allow add-on developers receive messages about specific events and react accordingly.
Clockify supports two-way event communications, where the add-on can subscribe to specific events as well as dispatch events that should trigger actions on the Clockify site.
Below is a sample snippet showing how to register a listener for an event:
Events
Events will contain the following fields:
The title field will be the name of the event. The body field will be an optional payload which depends on the event type.
Current events that can be listened for are:
The above events are not final and are subject to change in the future.
In addition to listening for events that Clockify dispatches, the add-on can also interact with Clockify by triggering its own events.
Current events that can be dispatched from the add-on are:
type
parameter. It requires the following payload:The following is a list of supported navigation locations:
Toast messages will be shown on the bottom-right section of the screen. The color of the background depends on the message type.
The following screenshot displays how an error
toast would look like in the UI:
Javascript Example
The following code example asks Clockify to display an error toast message like in the screenshot above.