CoWork Command
The CoWork Command-trigger allows to define commands that are used from an i-net CoWork 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:
-
Command - is entered in the chat window to execute the task.
-
Description - is displayed in the chat window when the command is entered.
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 /
.
Command
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.
Placeholder
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}
.
Restriction for use
The following restrictions apply to the usage of a command for users other than the task owner:
-
If the task owner is a CoWork administrator: every other user can use the command in any channel, even in direct message conversations.
-
If the task owner is a team administrator: every member user of the team can use the command in the team channels
-
If the task owner is a channel user only: every other user can use the command in channels, the task owner is a member of, even in direct message conversations.
Example: OpenWeather Command
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:
-
CoWork Command trigger: with the command
weather <City>
. The additional city extension will be rendered as placeholder to indicate that additional input will be used ascowork.command.parameter
. -
OpenWeatherMap job: the placeholder
cowork.command.parameter
is being used as location for the job. -
CoWork Message action: the jobs response data will now be sent back to the originating channel using the placeholder
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.-
Note, that the channel can either be selected or a placeholder can be used.
-
Running the command in the chat window looks like the following: