Console integration

Updated at:

If you need to share STAROps pages with others or embed them in third-party systems, you can generate password-free, login-free access links.

Overview

A generated link consists of three parts: a fixed base URL, configuration parameters, and an access credential called a Ticket.

  • Each Ticket can be opened only once in a browser and expires after 24 hours by default.

  • Users who access the link do not need to log in to Alibaba Cloud.

  • URL format: https://starops.console.alibabacloud.com?param1&param2

  • Multiple parameters are supported and connected with the & operator.

Prerequisites: Permission Setup

Generated links inherit the permissions of the RAM user or account that calls the CreateTicket API. For security, we recommend using a RAM user rather than your main account.

Note

Main account users have all permissions by default and do not need additional authorization.

The following table lists the required permissions for each scenario.

Scenario

Required Authorization

Generate a single link

  1. Grant the RAM user resource-specific permissions for the STAROps pages to be shared.

  2. Grant the cms:CreateTicket permission using the following policy:

    {"Version":"1","Statement":[{"Effect":"Allow","Action":"cms:CreateTicket","Resource":"acs:cms:*:*:ticket/*"}]}

Dynamically generate links for third-party system embedding

  1. Create a RAM user and configure access credentials.

  2. Grant the RAM user the AliyunSTSAssumeRoleAccess managed policy for STS role assumption.

  3. Grant the RAM role the cms:CreateTicket permission as described in the single-link scenario above.

Generate a Single Password-Free Login Link

  1. Get a Ticket. Call the CreateTicket API to obtain a Ticket. Each Ticket is bound to a single browser session (identified by the browser and host), and expires after 24 hours by default.

  2. Compose the link. Append the Ticket to the base URL as the sls_ticket parameter. For example:

    https://starops.console.alibabacloud.com?sls_ticket=eyJ***************.eyJ******************.KUT****************
  3. Test the link. Open the link in a browser. If the page loads correctly, the login-free link is working.

Important

Opening the link to test it counts as the first browser open, which invalidates the Ticket. You must call CreateTicket again to get a fresh Ticket before sharing the link. Do not send links directly through messaging or email clients, as some clients prefetch URLs and will consume the Ticket. Instead, copy the composed link to a file and transfer it as an attachment.

Dynamically Generate Links for Third-Party System Embedding

Because each Ticket expires after 24 hours and can only be used once, production systems should call CreateTicket dynamically to obtain a fresh Ticket each time a link is needed.

  • Default Ticket validity: 24 hours

  • No limit on the total number of Tickets that can be created

  • CreateTicket API QPS limit: 10 requests per second per user

Step 1: Generate a Ticket Using a RAM User (Java Example)

Add the following Maven dependency to your project:

<dependency>
    <groupId>com.aliyun</groupId>
    <artifactId>cms20240330</artifactId>
    <version>LATEST</version>
</dependency>

Use the following Java sample to call CreateTicket:

import com.aliyun.cms20240330.Client;
import com.aliyun.cms20240330.models.CreateTicketRequest;
import com.aliyun.cms20240330.models.CreateTicketResponse;
import com.aliyun.teaopenapi.models.Config;

public class CreateTicketSample {

    public static void main(String[] args) throws Exception {
        // Initialize the client using environment variables for credentials.
        // WARNING: Code exposure may leak your AccessKey and threaten all resources.
        // Use STS temporary credentials for better security in production.
        Config config = new Config()
            // Read AccessKey ID from environment variable
            .setAccessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
            // Read AccessKey Secret from environment variable
            .setAccessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));

        // Endpoint reference: https://help.aliyun.com/en/cms/cloudmonitor-2-0/developer-reference/api-cms-2024-03-30-endpoint
        config.endpoint = "cms.cn-hangzhou.aliyuncs.com";

        Client client = new Client(config);

        // Build the CreateTicket request
        CreateTicketRequest request = new CreateTicketRequest();
        // Specify the URL of the STAROps page to embed
        request.setUrl("https://starops.console.alibabacloud.com/chat");

        // Call the API
        CreateTicketResponse response = client.createTicket(request);

        // Extract the Ticket from the response
        String ticket = response.getBody().getData().getTicket();
        System.out.println("Ticket: " + ticket);

        // Compose the login-free link
        String loginFreeUrl = "https://starops.console.alibabacloud.com/chat?sls_ticket=" + ticket;
        System.out.println("Login-free URL: " + loginFreeUrl);
    }
}

Step 2: Compose the Login-Free Link

Append the Ticket returned by the API to your target URL as the sls_ticket query parameter:

https://starops.console.alibabacloud.com/chat?sls_ticket={ticket}

You can also append additional display parameters before the Ticket parameter. See Adjust Page Display below for the full list of supported parameters.

Adjust Page Display

You can control how embedded pages appear by adding query parameters to the URL.

Common Parameters

The following parameters apply to all STAROps embedded pages.

Parameter

Type

Required

Description

Example

hideSTAROpsHeader

boolean

No

Hides the page header.

hideSTAROpsHeader=true

hideSTAROpsSidebar

boolean

No

Hides the page sidebar.

hideSTAROpsSidebar=true

showCreditsNotice

boolean

No

Controls whether credit notifications are displayed.

showCreditsNotice=false

staropsClusterRegion

string

No

Specifies the region of the STAROps cluster.

staropsClusterRegion=cn-beijing

hideWorkspaceSwitch

boolean

No

Hides the workspace selector in the input box when set to true.

hideWorkspaceSwitch=true

hideSTAROpsNavChat

boolean

No

Hides New Chat in the employee sidebar.

hideSTAROpsNavChat=true

hideSTAROpsNavMission

boolean

No

Hides Missions in the employee sidebar.

hideSTAROpsNavMission=true

hideSTAROpsNavFindings

boolean

No

Hides Findings in the employee sidebar.

hideSTAROpsNavFindings=true

hideSTAROpsNavFabric

boolean

No

Hides Fabric in the employee sidebar.

hideSTAROpsNavFabric=true

hideSTAROpsNavSettings

boolean

No

Hides Settings in the employee sidebar.

hideSTAROpsNavSettings=true

hideSTAROpsNavEmployees

boolean

No

Hides Digital Employees in the global sidebar.

hideSTAROpsNavEmployees=true

hideSTAROpsNavSkills

boolean

No

Hides Skills in the global sidebar.

hideSTAROpsNavSkills=true

hideSTAROpsNavNotification

boolean

No

Hides Notification in the global sidebar.

hideSTAROpsNavNotification=true

hideSTAROpsNavUsage

boolean

No

Hides Subscription and Usage in the global sidebar.

hideSTAROpsNavUsage=true

Chat Page Parameters

The following parameters apply to the chat page at https://starops.console.alibabacloud.com/chat.

Parameter

Type

Required

Description

Example

initWorkspace

string

No

Sets the default workspace when the page loads.

initWorkspace=my-workspace

assistantId

string

No

Sets the default digital employee (AI assistant) when the page loads. Not supported for the default employee apsara-ops.

assistantId=my-assistant

initialQuestion

string

No

A question to send automatically when the page loads. Use together with initWorkspace and assistantId.

initialQuestion=Hello

threadId

string

No

The ID of an existing conversation to open directly.

threadId=thread-xxx

Use Case 1: Auto-Ask a Question on Page Open

To have the embedded page automatically send a question when it loads, combine initWorkspace, assistantId, and initialQuestion:

https://starops.console.alibabacloud.com/chat?initWorkspace={workspace}&assistantId={assistantId}&initialQuestion={question}&sls_ticket={sls_ticket}

Use Case 2: Open an Existing Conversation

To embed a specific existing conversation, use threadId together with assistantId:

https://starops.console.alibabacloud.com/chat?threadId={threadId}&assistantId={assistantId}&sls_ticket={sls_ticket}