The Google Trends connector lets your AI agent act in each user's Google Trends account. Each user signs in to Google Trends once, and Scalekit stores and refreshes their tokens, so your agent never handles credentials. It comes with 2 tools.
- Tools
- 2
- What they doRead · write · destructive
- 1 · 1 · 01 read1 write0 destructive
- Users sign in with
- OAuth
- OAuth app
- Your own Google app
Setup
Install the SDK
Terminal window npm install @scalekit-sdk/node dotenvTerminal window pip install scalekit-sdk-python python-dotenvSet your credentials
Add your Scalekit credentials to your
.envfile. Find values in app.scalekit.com > Developers > API Credentials..env SCALEKIT_ENVIRONMENT_URL=<your-environment-url>SCALEKIT_CLIENT_ID=<your-client-id>SCALEKIT_CLIENT_SECRET=<your-client-secret>Create the Google Trends connection
In AgentKit > Connections, create a Google Trends connection and copy its redirect URI. The name you give it is the
connection_nameyour code passes. See Configure connections.Register a Google OAuth app
Google Trends connections use your own OAuth app. Register one with Google and add the redirect URI you copied.
Then enter the app's Client ID and Client Secret on the Google Trends connection.
Authorize a user and make your first call
quickstart.mts import { ScalekitClient } from '@scalekit-sdk/node'import 'dotenv/config'import { createInterface } from 'node:readline/promises'const scalekit = new ScalekitClient(process.env.SCALEKIT_ENVIRONMENT_URL,process.env.SCALEKIT_CLIENT_ID,process.env.SCALEKIT_CLIENT_SECRET,)const actions = scalekit.actionsconst connector = 'googletrends'const identifier = 'user_123'// Generate an authorization link for the userconst { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })console.log('Authorize Google Trends:', link)const rl = createInterface({ input: process.stdin, output: process.stdout })await rl.question('Press Enter after authorizing...')rl.close()// Make your first callconst result = await actions.executeTool({connector,identifier,toolName: 'googletrends_get_operation',toolInput: { name: 'v1alpha.d3f3ded6-6fbe-4625-9bf1-d71d6312c9c9' },})console.log(result)Terminal window npx tsx quickstart.mtsquickstart.py import osfrom scalekit import ScalekitClientfrom dotenv import load_dotenvload_dotenv()scalekit_client = ScalekitClient(env_url=os.getenv("SCALEKIT_ENVIRONMENT_URL"),client_id=os.getenv("SCALEKIT_CLIENT_ID"),client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),)actions = scalekit_client.actionsconnection_name = "googletrends"identifier = "user_123"# Generate an authorization link for the userlink_response = actions.get_authorization_link(connection_name=connection_name,identifier=identifier,)print("Authorize Google Trends:", link_response.link)input("Press Enter after authorizing...")# Make your first callresult = actions.execute_tool(tool_input={"name":"v1alpha.d3f3ded6-6fbe-4625-9bf1-d71d6312c9c9"},tool_name="googletrends_get_operation",connection_name=connection_name,identifier=identifier,)print(result)Terminal window python quickstart.pyEach user signs in once. See Authorize a user for the full flow and statuses.
Tools
Pass the exact name toexecute_toolgoogletrends_get_operationGet the current status and result of a Google Trends API (alpha) long-running operation by its name.Read-onlyGet Operation
Get the current status and result of a Google Trends API (alpha) long-running operation by its name. Returns an Operation object with name and a done boolean; once done, the response includes a time series with per-point searchInterest (raw) and scaledSearchInterest (0-100 scaled, matching the Trends website) — the exact envelope beyond these fields is not fully confirmed from available sources, so treat any other fields as undocumented. Use this to poll a job after starting it with fetch_time_series; call it repeatedly until done is true. Requires an operation name returned by fetch_time_series.
Inputs
namestringrequired- Operation name to poll, copied verbatim from the "name" field returned by the fetch_time_series call that started this job (e.g. "v1alpha.d3f3ded6-6fbe-4625-9bf1-d71d6312c9c9"). Use it exactly as returned — do not strip, add, or reconstruct any prefix.
project_idstring- Optional Google Cloud project ID to bill this call's quota against, sent as the x-goog-user-project header. If omitted, Google uses the project already tied to the connected OAuth credentials (confirmed by live testing) — match whatever value, if any, was used for the fetch_time_series call that started this operation.
googletrends_fetch_time_seriesStart an asynchronous search-interest time-series query in Google Trends for one or more terms, scoped to a country or region, date range, and interval.WriteFetch Time Series
Start an asynchronous search-interest time-series query in Google Trends for one or more terms, scoped to a country or region, date range, and interval. Returns a long-running Operation envelope immediately, e.g. {"name": "v1alpha.d3f3ded6-6fbe-4625-9bf1-d71d6312c9c9", "done": false} — not the time series data itself. Use this to start a query; call googletrends_get_operation next with the returned name to poll until done and retrieve the actual search-interest results. Requires a Google Cloud project accepted into the Google Trends API alpha program, with the Search Trends API enabled.
Inputs
end_time_secondsintegerrequired- End of the time range to query, as Unix epoch seconds (UTC).
geo_codestringrequired- ISO country code identifying the country or region to fetch search interest for, e.g. "US" or "CH".
start_time_secondsintegerrequired- Start of the time range to query, as Unix epoch seconds (UTC). The API covers a rolling 5-year window; convert your desired start date to epoch seconds before calling this tool.
termsarrayrequired- Array of search terms to compare, each an object with a value (the search phrase) and a type. The only confirmed type value in this alpha is "BROAD"; no other type is documented. Example: [{"value": "gold", "type": "BROAD"}]. Multiple terms can be passed in one call to compare them on a consistent scale, unlike the Trends website's 8-term UI limit.
geo_typestring- How geo_code should be interpreted. The only confirmed value is "GEO_TYPE_COUNTRY_OR_REGION" (geo_code is treated as a country/region code); this is also the default, so most callers can leave it unset.default
GEO_TYPE_COUNTRY_OR_REGION project_idstring- Optional Google Cloud project ID to bill this call's quota against, sent as the x-goog-user-project header. If omitted, Google uses the project already tied to the connected OAuth credentials — confirmed by live testing (an omitted/empty value falls back to the OAuth grant's own project rather than being rejected). Only set this to point the call at a different project you have serviceusage.services.use permission on; that project must also have the Search Trends API enabled.
time_resolutionstring- Interval at which the time series is aggregated. Confirmed values are DAY, WEEK, MONTH, and YEAR; HOUR is not yet supported in this alpha. Defaults to DAY.one of
DAYWEEKMONTHYEARdefaultDAY
No tools match.