Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
FukuyamaS
Contributor
Contributor

How to call a custom REST chatbot from a Qlik Cloud sheet using Advanced Analytics (endpoints.ScriptAggrStr)? Getting 500/FAILED_PRECONDITION

 

I’m trying to build an interactive sheet where users type a question (Variable input) and a Text object shows a response from our in-house LLM chatbot that exposes a REST API. I created an Advanced Analytics connection pointing at our endpoint, and I can successfully pull data via the Data Load Editor with the REST settings.

What I want is to call the same endpoint from a chart expression using the SSE/analytics-endpoints functions. I’m following Qlik’s docs for analytic connections and SSE syntax, as well as the example that shows using endpoints.scriptAggrStr(...) in a chart. Notably, the docs mention the space-aware connection name (prefixing the connection with a colon to resolve to the current space) and show an example like this:

 
if(vQuestion <> '',
  endpoints.scriptAggrStr(
    '{"RequestType":"endpoint","endpoint":
    {"connectionname":":Amazon_Titan_(Amazon_Bedrock)","column":"outputText"}}'
  , vQuestion )
)

 

(From Getting started with analytic connections → “Relative space syntax in chart expression”.) help.qlik.com

I adapted that pattern to my connection and column name. My current expression (in a Text & image object) looks like:

 

 
=if(Len(Trim(vQuestion))>0,
  endpoints.ScriptAggrStr(
   '{"RequestType":"endpoint",
    "endpoint":{ "connectionname":":LLM_Chat",
     "column":"text" }
    }'
  , vQuestion )
)
 
  • vQuestion is the variable bound to a Variable input component.

  • The connection “LLM_Chat” lives in the same shared space as the app (hence the leading : per docs). help.qlik.com

  • I mapped the response column in the connection so that text is a string column (per “Response items / Response table (JMESPath)” guidance). help.qlik.com

 

 

Problem
When the expression runs, I get:

grpc::StatusCode::FAILED_PRECONDITION: 'Error returned by endpoint: InternalServerError'
 

(HTTP 500 series). I also saw CSP errors in the browser dev tools; I added our domain to CSP in the tenant admin, but the error persists.

スクリーンショット 2025-11-20 115118.png

 

 

What I’ve verified

  • The model endpoint itself works from my machine via curl with the same request body (so the model is up and reachable).

  • Machine learning endpoints are enabled at the tenant level (Admin → Settings → Feature control), as required by the “Getting started with analytic connections” page. help.qlik.com

  • SSE function type should be ScriptAggrStr (string in, string out, single row) per “Server-side extensions syntax”. help.qlik.com

  • The connection is configured with a response table/column so the column parameter points to an actual string field (docs: Response items / JMESPath and “Load all available items” first to inspect columns). help.qlik.com

  • I also tried the same expression without the leading colon in connectionname and also using a fully qualified SpaceName:ConnectionName reference; behavior is unchanged. (Docs show both variants.) help.qlik.com

  • I reviewed the Amazon Comprehend example that uses endpoints.ScriptAggrStr with a variable input; my pattern mirrors this. help.qlik.com

 

Questions

  1. Is my endpoints.ScriptAggrStr payload correct for calling a custom REST analytics connection? Are there any required keys besides "RequestType":"endpoint" and "endpoint":{"connectionname":"…","column":"…"}}? The examples I’ve found vary a bit and official reference for the endpoints.Script* parameters is sparse. (There’s a community thread asking about docs, but I couldn’t find a full parameter reference.) community.qlik.com

  2. In the connection dialog, what’s the recommended way to set Response table (JMESPath) for typical chatbot JSON? For example, if the API returns either:

    • {"answer":"...", "usage":{...}} → should I create a table that exposes an answer column and then reference "column":"answer" in the expression?

    • or {"output":[{"content":"..."}]} → should the table be output with a content column, then "column":"content"?

  3. Could 500/FAILED_PRECONDITION be caused by the response schema not matching the configured column (e.g., returning an array/object when the column expects a scalar string), or by a missing association field? Any best-practice tips to test the connection first in the Data Load Editor (“Load all available items”), confirm the actual column names, then switch to the chart expression? help.qlik.com

  4. Any known CSP gotchas for analytics endpoints? I’ve allowed our API host, but I’m still seeing the same SSE 500 in charts.

Environment

  • Qlik Cloud (SaaS). Machine learning endpoints enabled. (Docs note these are off by default; we enabled them via Admin → Feature control.) help.qlik.com

  • The analytic connection is in the same shared space as the app; expression uses ":ConnectionName" (space-relative) per docs. help.qlik.com

  • Browser: Chrome (latest).

  • The REST endpoint requires Content-Type: application/json and Bearer auth (configured in the connection).

Any working examples or a definitive reference for the endpoints.Script* JSON payload (specifically accepted keys and how column maps to the connection’s response schema) would be hugely appreciated. Thanks!

 

Docs I followed

  • Getting started with analytic connections (space-aware connectionname and chart example). help.qlik.com

  • Server-side extensions syntax (which ScriptAggrStr to use in charts, data types). help.qlik.com

  • Using analytic connections in a visualization expression – Amazon Comprehend example (pattern for endpoints.ScriptAggrStr with a variable). help.qlik.com


 

Labels (3)
0 Replies