KosmoKrator

analytics

Segment CLI for Cron Jobs

Use the Segment CLI for cron jobs with headless JSON commands, schema discovery, credentials, and permission controls.

8 functions 4 read 4 write API token auth

Segment CLI for Cron Jobs

Schedule repeatable integration workflows from cron while keeping credentials in KosmoKrator config.

Use the headless CLI from cron when an operation should run without an interactive agent session. The Segment CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.

Command Shape

# Segment CLI for Cron Jobs
kosmokrator integrations:configure segment --set write_key="$SEGMENT_WRITE_KEY" --enable --read allow --write ask --json
kosmo integrations:call segment.segment_identify '{"userId":"example_userId","traits":"example_traits"}' --json

Discovery Before Execution

Agents and scripts can inspect Segment docs and schemas before choosing a function.

kosmo integrations:docs segment --json
kosmo integrations:docs segment.segment_identify --json
kosmo integrations:schema segment.segment_identify --json
kosmo integrations:search "Segment" --json
kosmo integrations:list --json

Useful Segment CLI Functions

FunctionTypeParametersDescription
segment.segment_identify Write userId, traits Identify a user in Segment with their traits. Links metadata about a user (name, email, plan, etc.) to a known userId so all their events can be attributed correctly.
segment.segment_track Write event, userId, properties Track a custom event for a user in Segment. Records actions your users perform along with optional properties describing the action.
segment.segment_page Write name, userId, properties Record a page view in Segment. Tracks when a user views a page, along with optional properties about the page.
segment.segment_group Write groupId, userId, traits Associate a user with a group (organization, company, account) in Segment. Lets you record group membership along with optional group traits.
segment.segment_get_workspace Read slug Get details of a Segment workspace by its slug. Requires an API token to be configured.
segment.segment_list_sources Read slug List all sources in a Segment workspace. Requires an API token to be configured.
segment.segment_get_source Read slug, id Get details of a specific Segment source by ID. Requires an API token to be configured.
segment.segment_get_current_user Read none Get the currently authenticated Segment user. Useful for verifying API token credentials are correct.

Automation Notes

Related Segment CLI Pages