How to: customise Looker Actions & make them work for you
By: Acrotrend Consultancy
Tags: Looker, AWS, Data Analytics, Data Science, Data Visualization

This is a tale of a hero visualisation platform, Looker is its name. Making insights actionable is its fantastic game!

As Looker says, with Looker Actions, you can analyse and act on your data. You can do everything from engaging with your users to updating records in any of the applications you use. From Slack to Segment.io, Looker has a set of amazing third party actions right out of the box. These actions are NOT limited to the ones provided out of the box, and you can build your own.

Actions primarily help users in 3 areas:

Act: The use case could be to create a marketing campaign based on a filtered user list.

Communicate: Send data to a subordinate or different department to be actioned

Deliver: Delivery/tracking of reports in an automated fashion

Let’s look at the power of the magic wand provided by Looker. Using Looker’s action hub, a package to develop custom Looker Actions, we took the Looker user’s experience to another level. Let’s be more specific here. In simple terms, we have built a simple set of microservices to send data from Looks ( click here to understand about Looks in detail) into Salesforce in seconds, in a simple and straightforward way.

So why is it a big thing?

Let’s deep dive into the whole process!

Looker Action

We have a built a custom action for Looker to enable data ingestion capabilities at the Looker end. For discussion’s sake let’s give this action a name. Let’s call it MyAction. MyAction enables client-specific data delivery endpoints to Looker. These actions are automatically attached to the dashboard gear menu in Looker — making it easily accessible for the user. For example, we have an action enabled to send customer churn data into a Salesforce instance which will help the marketer to target/track these churners in Salesforce. After applying relevant filters user can trigger the data delivery job.

See, it’s so simple! Let’s look into the building blocks.

Looker Action Hub provides Looker Action API. This is useful to build an action directly into an existing web service in any language, you can easily have your server implement Looker Action API. The Action API is a simple webhook-like API to accept actions from Looker. Your server will provide a few endpoints that Looker can connect to list and execute actions. By implementing the Action API your server becomes an “Action Hub” that users can connect Looker to. An Action Hub can expose one or more actions.

Going with the serverless approach you can create your own Actions Hub on an AWS Lambda exposed through API Gateway. Looker will send an HTTP POST request with an empty body to this API Gateway endpoint. This endpoint should return a JSON payload with an “integrations” key containing a list of actions.

Here’s an example of a list containing a single integration:

{ "integrations": [ { "name": "my_action", "label": "My Great Action", "supported_action_types": ["cell"], "url": "https://example.com/actions/my_action/execute", "icon_data_uri": "data:image/gif;base64,R0lGODlhEAA....", "params": [ {"name": "api_key", "label": "API Key", "required": true} ] } ] }

You can find the full data structure of the payload here.

When the user clicks on the action from the Looker Dashboard, Looker will run the relevant query and then POST the data to execute endpoint.

For more information check out Looker Action Hub.

Looker Actions can also be implemented directly into views using LookML which makes it sit closer to your dashboard and in case you want to pass liquid parameters or any dynamic values from LookML to your endpoint, this makes it possible.

Here’s an example of implementing action within a view:

view: view_name { measure: field_name { action: { label: "Label to Appear in Action Menu" url: "https://example.com/posts" icon_url: "https://looker.com/favicon.ico" form_url: "https://example.com/ping/{{ value }}/form.json" user_attribute_param: { user_attribute: user_attribute_name name: "name_for_json_payload" } param: { name: "some_auth_code" value: "abc123456" } form_param: { name: "title" type: select | string | textarea label: "desired label name" description: "description text" required: yes | no default: "value string" option: { name: "name string" value: "value string" } } } } }

Check out this link for more on this.

And so, what about when you want to get some input from the user when they click on a Looker Action? You might have noticed in the LookML snippet above there is a key called “form_param”. That’s for opening a pop-up form to get more inputs from the user based on your use case. Forms can be served from your own Action Hub as well.

Salesforce

Dumping data straight into custom Salesforce objects wouldn’t add much value. Instead, we have been using Salesforce API to perform specific tasks, for example, creating a campaign. However, if you still need just the data, it will be delivered to its destination in a disciplined manner.

Moral of the story is that you now have the data for potential churners in Salesforce which you can use to target these customers through personalised messages, monitor their activity, built customer journeys, etc through Salesforce. The Looker dashboard provided the insight which can now be used to take the relevant action and that helps you improve business outcomes.

On the closing note, it is amazing how Looker has provided the tools to close the end to end loop from data, insights to actions. There are a number of use cases to enable using this capability. Combining this with serverless power of AWS you can turn your insights into actions seamlessly and with no management of server code, you can focus more on your users. We have built a suite of Looker Actions interacting with the third-party applications, to know more and understand how we can help you turn insights into actions that you can actually act upon, please contact us.