Console integration
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¶m2Multiple 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.
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 |
|
Dynamically generate links for third-party system embedding |
|
Generate a Single Password-Free Login Link
Get a Ticket. Call the
CreateTicketAPI 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.Compose the link. Append the Ticket to the base URL as the
sls_ticketparameter. For example:https://starops.console.alibabacloud.com?sls_ticket=eyJ***************.eyJ******************.KUT****************Test the link. Open the link in a browser. If the page loads correctly, the login-free link is working.
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
CreateTicketAPI 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 |
| boolean | No | Hides the page header. |
|
| boolean | No | Hides the page sidebar. |
|
| boolean | No | Controls whether credit notifications are displayed. |
|
| string | No | Specifies the region of the STAROps cluster. |
|
| boolean | No | Hides the workspace selector in the input box when set to |
|
| boolean | No | Hides New Chat in the employee sidebar. |
|
| boolean | No | Hides Missions in the employee sidebar. |
|
| boolean | No | Hides Findings in the employee sidebar. |
|
| boolean | No | Hides Fabric in the employee sidebar. |
|
| boolean | No | Hides Settings in the employee sidebar. |
|
| boolean | No | Hides Digital Employees in the global sidebar. |
|
| boolean | No | Hides Skills in the global sidebar. |
|
| boolean | No | Hides Notification in the global sidebar. |
|
| boolean | No | Hides Subscription and Usage in the global sidebar. |
|
Chat Page Parameters
The following parameters apply to the chat page at https://starops.console.alibabacloud.com/chat.
Parameter | Type | Required | Description | Example |
| string | No | Sets the default workspace when the page loads. |
|
| string | No | Sets the default digital employee (AI assistant) when the page loads. Not supported for the default employee |
|
| string | No | A question to send automatically when the page loads. Use together with |
|
| string | No | The ID of an existing conversation to open directly. |
|
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}