AWS Business Intelligence Blog

Run Amazon QuickSight API commands and ask QuickSight questions in Slack

Amazon QuickSight is a robust, cloud-powered business intelligence (BI) service that facilitates insights delivery across organizations. It enables the creation and publication of interactive dashboards or paginated reports accessible via web browsers and mobile devices, and connects seamlessly with AWS and other data sources.

Slack, known for its channel-based messaging platform, streamlines communication within teams, supporting file sharing and collaboration. Its integration capabilities allow it to become a centralized workspace where teams can engage with various tools, including QuickSight, promoting data-driven decision-making.

This post delves into integrating QuickSight with Slack through AWS Chatbot. AWS Chatbot serves as a ChatOps tool within AWS, facilitating communication and commands through chat clients. It supports notifications from AWS services to chat channels, streamlining monitoring and issue resolution processes.

Key features of AWS Chatbot

AWS Chatbot offers the following benefits:

  • Running AWS Command Line Interface (AWS CLI) commands in chat channels with appropriate parameter and permission checks.
  • Delivery of notifications to chat channels upon administrator approval, and sending of event and alarm notifications using Amazon Simple Notification Service (Amazon SNS) topics.
  • Direct responses to service inquiries in chat with excerpts from AWS documentation and support articles by AWS Chatbot.
  • Usage of AWS Resource Explorer for detailed resource-related information retrieval and display.
  • AWS CLI support for a wide range of AWS services. This functionality simplifies the process of monitoring and administering your AWS resources through chat clients. With AWS Chatbot, your teams can access real-time diagnostic information, modify AWS resources, run AWS Systems Manager runbooks, and initiate long-running tasks—all conveniently managed from a centralized hub. AWS Chatbot commands adhere to the familiar AWS CLI syntax.

Solution overview

In this post, we focus on two key use cases that highlight the power of integrating QuickSight with Slack, facilitated by AWS Chatbot. These use cases demonstrate how teams can enhance their data-driven decision-making processes directly within their preferred communication platforms:

  • Run QuickSight API commands through Slack – This scenario illustrates the practicality of running QuickSight API commands directly from Slack. This enables team members to efficiently manage QuickSight resources, such as listing dashboards, querying specific analytics, and modifying datasets, through simple command line interactions within Slack channels. This seamless integration not only boosts productivity but also enhances data security by consolidating commands in a secure and familiar environment.
  • Interactive queries with natural language in Slack – This use case delves into the innovative capability of posing natural language questions in Slack to get accurate information about how to interact with QuickSight. This feature allows users to effortlessly ask about performing specific tasks in QuickSight, such as how to update analyses or change data ingestion schedules. By using AWS Chatbot to understand and respond to these inquiries, teams can quickly access valuable information and guidance without needing to navigate away from their conversations or dive into documentation.

In the following sections, we demonstrate how to integrate QuickSight and Slack using AWS Chatbot to implement these use cases.

Set up AWS Chatbot in Slack

Complete the following steps to set up AWS Chatbot in Slack:

  1. On the AWS Chatbot console, choose Slack on the Chat Client menu.
  2. Authorize AWS Chatbot to access your Slack workspace.

When integrating AWS Chatbot with Slack for QuickSight commands, choosing between a custom workspace and the main workspace is crucial for security and efficiency.

Using the main workspace increases the risk of sensitive data exposure and running unauthorized commands due to its broader access. A custom workspace limits visibility and access, enhancing security.

For securing sensitive data and operations, a custom workspace is recommended for AWS Chatbot and QuickSight integration, offering tailored access and a focused workspace.

Configure a Slack channel for AWS Chatbot

Complete the following steps to configure a Slack channel for AWS Chatbot:

  1. On the AWS Chatbot console, choose Configure new channel.
  2. Enter a configuration name.
  3. Enter the desired Slack channel for running commands.

For private Slack channels, obtain the channel URL by choosing (right-clicking) the channel name in the left sidebar in Slack, and choosing Copy link from the context menu.

  1. Define member AWS Identity and Access Management (IAM) permissions, confirming that permissions for QuickSight actions are allowed. AWS Chatbot offers two methods:
    1. Channel IAM role – All members share identical action permissions.
    2. User roles – Each member uses an IAM role for actions. (We use this option for this post.)

Choose your permission method based on your security requirements and channel objective. For further details on permissions, refer to Managing user roles.

The following IAM policy allows list and describe actions on all QuickSight resources, using the following parameters:

  • Effect – Specifies the effect of the statement; “Allow” means the actions listed are permitted.
  • Action – This defines what actions the policy allows. In this case, “quicksight:List*” and “quicksight:Describe*” mean that the policy allows actions within QuickSight that involve listing and describing resources, respectively. The asterisk (*) acts as a wildcard, meaning it applies to all actions that start with “List” and “Describe”.
  • Resource – “*” indicates that the permissions apply to all QuickSight resources. This is a broad scope, granting the ability to list and describe every QuickSight resource the policy’s subject has access to.
json
{
    "Version": "2012-10-17",
    "Statement": [
                    {
                    "Sid": "Statement1",
                    "Effect": "Allow",
                    "Action": [
                            "quicksight:List*",
                            "quicksight:Describe*"
                            ],
                    "Resource": "*"
                    }
                  ]
}

Guardrail policies provide fine-grained control over channel participant permissions and AWS Chatbot operations, and take precedence over user and channel roles. They can be applied to both channel and user-based roles, and take effect at runtime. Members are permitted to perform actions that fall within the overlap of role-based permissions and guardrail policy guidelines.

AWS service role IAM policies cannot be used as guardrail policies.

Finalize the integration in Slack

Complete the following steps to finish your integration:

  1. Navigate to the configured Slack channel to find the AWS Chatbot app added with a welcome message.

In this post, we opted for a user-based approach for adding the chatbot, which involved inviting the chatbot directly into a channel using the @aws command. This method works seamlessly for those who have the necessary permissions to add bots to their channels. If you have the necessary permissions, this should prompt you to invite the chatbot directly.

If your organization uses channel roles and you find that the chatbot does not appear automatically, navigate to the channel settings to invite the chatbot manually.

  1. Choose Choose user role to choose an IAM role for running user-level commands.
  2. Choose your account number in Slack’s response.
  3. On the AWS Chatbot console, pick a role you have permission to assume.
  4. Approve the AWS Chatbot request to use the role in Slack.
  5. If necessary, re-authorize AWS Chatbot for the selected Slack workspace.

Now you can return to Slack and start entering QuickSight commands and asking questions.

Run QuickSight commands

To run QuickSight API commands in Slack, use @aws quicksight --help to view available commands. You can run commands such as listing dashboards or querying specific dashboard names with appropriate parameters.

The following are some example commands:

@aws quicksight list-dashboards --aws-account-id YOUR_ACCOUNT_ID --region YOUR_REGION

@aws quicksight list-dashboards --aws-account-id YOUR_ACCOUNT_ID --region YOUR_REGION 
--query "DashboardSummaryList[?starts_with(Name, 'Sales')].{Name:Name, DashboardId:DashboardId}"

Ask QuickSight questions through AWS Chatbot

AWS Chatbot can respond to natural language inquiries about AWS services by consulting AWS documentation and support libraries. Make sure the associated IAM role has the necessary permissions for the relevant service inquiries.

The following are some example questions:

@aws quicksight how do I update an analysis?
@aws quicksight how do I change the Spice ingestion schedule?
@aws quicksight how do I change the Spice ingestion schedule using API?

Conclusion

The integration of QuickSight with Slack through AWS Chatbot represents a significant advancement in how teams can interact with data analytics and operational tasks within their communication platforms. It simplifies the process of monitoring, querying, and managing AWS resources, making it an invaluable asset for fostering an environment where informed decisions are made swiftly and collaboratively. Make sure that you follow the setup and configuration steps carefully, and tailor the permissions and policies to match the security requirements of your organization. With these tools, your team can take advantage of the full power of AWS and QuickSight directly from Slack, streamlining workflows and boosting productivity.

Ready to transform your team’s data interaction and operational efficiency? Start integrating QuickSight with Slack today to unlock real-time insights and streamline decision-making processes right where your conversations happen. Don’t let the potential of your data go untapped. Explore AWS Chatbot’s capabilities, set up your integration, and empower your team to make informed decisions faster and more collaboratively. Dive into a smarter way of working—your next level of productivity is just an integration away. Begin now and see the difference for yourself!


About the author

Gilbert V Lepadatu is a QuickSight Sr. Specialist Solution Architect. With experience in two Fortune 100 companies, he has spearheaded data science, analytics, and automation initiatives, achieving significant revenue growth and operational efficiencies. Leveraging a PhD in Philosophy and two masters’ degrees, Gilbert has also contributed to academia, teaching classes on statistics and data visualization. His diverse skill set encompasses AWS services, data visualization, reporting and pipelines, data science and analytics, machine learning and communication across technical levels.