The CoWork Command-trigger allows to define commands that are used from an INETAPP chat to execute a Task Planner task. This allows, for example, running a backup task, running a report, or sending email using a command.
The trigger takes two parameters:
Once a command is registered, it is available for use in the CoWork application. There is a restriction on who can use this command depending on the access permissions of the user who created (or owns) the task in the Task Planner.
Note: Custom commands are displayed for a channel on the bots help page, when entering /
in the chat window.
Note: Entering commands in the chat window has to be started using /
.
The Command consists of one or more keywords. Additional input in the chat that come after a command will be used as parameters and is available as placeholder in the Task Planner task.
To indicate that a command can be extended with parameters - or to give a hint about the syntax of the parameters, a hint can be inserted in the command line. The hint consists of a beginning #
or <
and is displayed in a different color in the chat window.
Example: Command to show the weather conditions without parameter indication
weather
Example: Commands to show the weather conditions with parameter indication. See full weather example below.
weather #enter city id weather <city>
Note: When using #
as parameter extension, the #
- symbol will be part of the command which is useful for IDs that require this format. The <
- symbol is not part of the resulting command.
Note: a command can only be registered once. If another user tries to register the same command again, an error will be displayed that this command was already registered.
There is a list of placeholders given to the job and action of the task:
{cowork.command.channelid}
- the ID of the CoWork channel{cowork.command.name}
- the name of the triggered command{cowork.command.parameters}
- additional command parameters as single string{cowork.command.parameter1}
... {cowork.command.parameter9}
- additional command parameter parts, separated on space characters. Parameters can additionally be quoted using double quotes.{cowork.command.userid}
- the ID of the user who triggered the command
Note: {cowork.command.parameters}
holds the full parameter string and is given in a CoWork chat right after the command. Up to nine parameters can be obtained individually using the placeholders {cowork.command.parameter1}
to {cowork.command.parameter9}
.
The following restrictions apply to the usage of a command for users other than the task owner:
The OpenWeather Command example shows a command trigger that runs the OpenWeatherMap plugin and returns the result to the channel of the user.
The following elements are configured:
weather <City>
. The additional city extension will be rendered as placeholder to indicate that additional input will be used as cowork.command.parameter
.cowork.command.parameter
is being used as location for the job.cowork.command.channel
. The message for the channel is composed from other placeholders to address the originating user, the input parameter from the command and the response from the OpenWeatherMap plugin.Running the command in the chat window looks like the following: