Lookerbot for Slack integrates with Looker, to let you query all your data directly from Slack. This allows everyone in your company to share data easily and answer data-driven questions instantly. Lookerbot can expand Looker URLs, and it allows you to create custom commands to run saved queries.
Expanding Looker URLs
If Lookerbot is added to a channel and the
LOOKER_SLACKBOT_EXPAND_URLS variable is set to
true, Lookerbot will expand shared URLs and Look URLs. If the Explore has an associated visualization, it will show an image of that visualization. If the Explore is a table, it will show the data as text.
For example, these two URLs will expand like so:
https://learnbeta.looker.com/x/3Hq6Q2j # share URL
https://learnbeta.looker.com/looks/263 # Look URL
Lookerbot also allows you to create custom commands for running saved queries. This allows you to easily run common queries and answer frequent questions!
To create custom commands, make sure to specify a custom command space, using the
LOOKER_CUSTOM_COMMAND_SPACE_ID variable during setup. Any dashboard saved in this Space will be available to use as a command.
To create a new command:
- Create a dashboard with a single element in the Lookerbot commands space. Only dashboards with single elements can currently be used with the Lookerbot.
- Give the dashboard a discoverable name. The name of the dashboard will be the name of the command. We recommend using only a few lowercase letters for ease of use.
- Add global filters to the dashboard in order to pass filter values to the command. Read about how to add filters to a dashboard in Looker here (optional).
- Add a description to the dashboard. This will appear next to the command when a user types
If you would like to split up commands into logical groups, you can create subspaces within the Lookerbot command space. This will group the commands in the help list.
In order to see all the available commands, type
help to Lookerbot (see how to do this below). This will give you a list like so:
You use a command by typing the name of the command, followed by any filter values you want to add. Filters are optional, and the query will run without that filter if no values are specified.
For example, we can run the
customer map in command, filtered for New York like so:
There are three ways to use commands:
- @mention Lookerbot. This can be done in any channel in which Lookerbot is present.
- Use the slash command. This can be done if the slash command has been configured during set up.
- Direct message Lookerbot. If you send a message directly to Lookerbot, you don’t need to prepend the command with anything.
Commands will also return data in different ways, depending on the visualization type of the underlying Look. There are three possible return formats:
1. Text: If the underlying Look is a table, the data will return as text:
2. Single Value Text: If the underlying Look is a Single Value visualization, the data will return as a text value:
3. Image: If the underlying Look is a chart, the data will return as a image of the visualization:
Hiding Commands and Subspaces
If you have some commands you do not want to appear in the
help menu, but you still want to use with Lookerbot, you can hide either the command or the entire subspace in which the command is saved.
Hide a command or subspace by starting the name with
For example, this subspace and this command will not be visible in the
In Lookerbot’s help menu listing the available commands, you can get a description of the dashboard that gets returned. To do this:
- In Looker, navigate to the dashboard.
- If you are using dashboard locks, unlock the dashboard.
- Click the dashboard’s gear and choose Edit Dashboard Settings.
- In the Description field, enter the description you want to appear in the Lookerbot help menu.
- Click Save.
- If you are using dashboard locks, lock the dashboard.
Expanding Looker URLS is not available in Direct Messages, because of the distinction made between private/public channels and direct messages in the legacy unfurling API capabilities used in Lookerbot.