Automate Segment tasks via Rube MCP (Composio): track events, identify users, manage groups, page views, aliases, batch operations. Always search tools first for current schemas.
Add this skill
npx mdskills install sickn33/segment-automationComprehensive Segment API automation with detailed workflows, naming conventions, and pitfall guidance
1---2name: segment-automation3description: "Automate Segment tasks via Rube MCP (Composio): track events, identify users, manage groups, page views, aliases, batch operations. Always search tools first for current schemas."4requires:5 mcp: [rube]6---78# Segment Automation via Rube MCP910Automate Segment customer data platform operations through Composio's Segment toolkit via Rube MCP.1112## Prerequisites1314- Rube MCP must be connected (RUBE_SEARCH_TOOLS available)15- Active Segment connection via `RUBE_MANAGE_CONNECTIONS` with toolkit `segment`16- Always call `RUBE_SEARCH_TOOLS` first to get current tool schemas1718## Setup1920**Get Rube MCP**: Add `https://rube.app/mcp` as an MCP server in your client configuration. No API keys needed — just add the endpoint and it works.2122231. Verify Rube MCP is available by confirming `RUBE_SEARCH_TOOLS` responds242. Call `RUBE_MANAGE_CONNECTIONS` with toolkit `segment`253. If connection is not ACTIVE, follow the returned auth link to complete Segment authentication264. Confirm connection status shows ACTIVE before running any workflows2728## Core Workflows2930### 1. Track Events3132**When to use**: User wants to send event data to Segment for downstream destinations3334**Tool sequence**:351. `SEGMENT_TRACK` - Send a single track event [Required]3637**Key parameters**:38- `userId`: User identifier (required if no `anonymousId`)39- `anonymousId`: Anonymous identifier (required if no `userId`)40- `event`: Event name (e.g., 'Order Completed', 'Button Clicked')41- `properties`: Object with event-specific properties42- `timestamp`: ISO 8601 timestamp (optional; defaults to server time)43- `context`: Object with contextual metadata (IP, user agent, etc.)4445**Pitfalls**:46- At least one of `userId` or `anonymousId` is required47- `event` name is required and should follow consistent naming conventions48- Properties are freeform objects; ensure consistent schema across events49- Timestamp must be ISO 8601 format (e.g., '2024-01-15T10:30:00Z')50- Events are processed asynchronously; successful API response means accepted, not delivered5152### 2. Identify Users5354**When to use**: User wants to associate traits with a user profile in Segment5556**Tool sequence**:571. `SEGMENT_IDENTIFY` - Set user traits and identity [Required]5859**Key parameters**:60- `userId`: User identifier (required if no `anonymousId`)61- `anonymousId`: Anonymous identifier62- `traits`: Object with user properties (email, name, plan, etc.)63- `timestamp`: ISO 8601 timestamp64- `context`: Contextual metadata6566**Pitfalls**:67- At least one of `userId` or `anonymousId` is required68- Traits are merged with existing traits, not replaced69- To remove a trait, set it to `null`70- Identify calls should be made before track calls for new users71- Avoid sending PII in traits unless destinations are configured for it7273### 3. Batch Operations7475**When to use**: User wants to send multiple events, identifies, or other calls in a single request7677**Tool sequence**:781. `SEGMENT_BATCH` - Send multiple Segment calls in one request [Required]7980**Key parameters**:81- `batch`: Array of message objects, each with:82 - `type`: Message type ('track', 'identify', 'group', 'page', 'alias')83 - `userId` / `anonymousId`: User identifier84 - Additional fields based on type (event, properties, traits, etc.)8586**Pitfalls**:87- Each message in the batch must have a valid `type` field88- Maximum batch size limit applies; check schema for current limit89- All messages in a batch are processed independently; one failure does not affect others90- Each message must independently satisfy its type's requirements (e.g., track needs event name)91- Batch is the most efficient way to send multiple calls; prefer over individual calls9293### 4. Group Users9495**When to use**: User wants to associate a user with a company, team, or organization9697**Tool sequence**:981. `SEGMENT_GROUP` - Associate user with a group [Required]99100**Key parameters**:101- `userId`: User identifier (required if no `anonymousId`)102- `anonymousId`: Anonymous identifier103- `groupId`: Group/organization identifier (required)104- `traits`: Object with group properties (name, industry, size, plan)105- `timestamp`: ISO 8601 timestamp106107**Pitfalls**:108- `groupId` is required; it identifies the company or organization109- Group traits are merged with existing traits for that group110- A user can belong to multiple groups111- Group traits update the group profile, not the user profile112113### 5. Track Page Views114115**When to use**: User wants to record page view events in Segment116117**Tool sequence**:1181. `SEGMENT_PAGE` - Send a page view event [Required]119120**Key parameters**:121- `userId`: User identifier (required if no `anonymousId`)122- `anonymousId`: Anonymous identifier123- `name`: Page name (e.g., 'Home', 'Pricing', 'Dashboard')124- `category`: Page category (e.g., 'Docs', 'Marketing')125- `properties`: Object with page-specific properties (url, title, referrer)126127**Pitfalls**:128- At least one of `userId` or `anonymousId` is required129- `name` and `category` are optional but recommended for proper analytics130- Standard properties include `url`, `title`, `referrer`, `path`, `search`131- Page calls are often automated; manual use is for server-side page tracking132133### 6. Alias Users and Manage Sources134135**When to use**: User wants to merge anonymous and identified users, or manage source configuration136137**Tool sequence**:1381. `SEGMENT_ALIAS` - Link two user identities together [Optional]1392. `SEGMENT_LIST_SCHEMA_SETTINGS_IN_SOURCE` - View source schema settings [Optional]1403. `SEGMENT_UPDATE_SOURCE` - Update source configuration [Optional]141142**Key parameters**:143- For ALIAS:144 - `userId`: New user identifier (the identified ID)145 - `previousId`: Old user identifier (the anonymous ID)146- For source operations:147 - `sourceId`: Source identifier148149**Pitfalls**:150- ALIAS is a one-way operation; cannot be undone151- `previousId` is the anonymous/old ID, `userId` is the new/identified ID152- Not all destinations support alias calls; check destination documentation153- ALIAS should be called once when a user first identifies (e.g., signs up)154- Source updates may affect data collection; review changes carefully155156## Common Patterns157158### User Lifecycle159160Standard Segment user lifecycle:161```1621. Anonymous user visits -> PAGE call with anonymousId1632. User interacts -> TRACK call with anonymousId1643. User signs up -> ALIAS (anonymousId -> userId), then IDENTIFY with traits1654. User takes action -> TRACK call with userId1665. User joins org -> GROUP call linking userId to groupId167```168169### Batch Optimization170171For bulk data ingestion:172```1731. Collect events in memory (array of message objects)1742. Each message includes type, userId/anonymousId, and type-specific fields1753. Call SEGMENT_BATCH with the collected messages1764. Check response for any individual message errors177```178179### Naming Conventions180181Segment recommends consistent event naming:182- **Events**: Use "Object Action" format (e.g., 'Order Completed', 'Article Viewed')183- **Properties**: Use snake_case (e.g., 'order_total', 'product_name')184- **Traits**: Use snake_case (e.g., 'first_name', 'plan_type')185186## Known Pitfalls187188**Identity Resolution**:189- Always include `userId` or `anonymousId` on every call190- Use ALIAS only once per user identity merge191- Identify before tracking to ensure proper user association192193**Data Quality**:194- Event names should be consistent across all sources195- Properties should follow a defined schema for downstream compatibility196- Avoid sending sensitive PII unless destinations are configured for it197198**Rate Limits**:199- Use BATCH for bulk operations to stay within rate limits200- Individual calls are rate-limited per source201- Batch calls are more efficient and less likely to be throttled202203**Response Parsing**:204- Successful responses indicate acceptance, not delivery to destinations205- Response data may be nested under `data` key206- Check for error fields in batch responses for individual message failures207208**Timestamps**:209- Must be ISO 8601 format with timezone (e.g., '2024-01-15T10:30:00Z')210- Omitting timestamp uses server receive time211- Historical data imports should include explicit timestamps212213## Quick Reference214215| Task | Tool Slug | Key Params |216|------|-----------|------------|217| Track event | SEGMENT_TRACK | userId, event, properties |218| Identify user | SEGMENT_IDENTIFY | userId, traits |219| Batch calls | SEGMENT_BATCH | batch (array of messages) |220| Group user | SEGMENT_GROUP | userId, groupId, traits |221| Page view | SEGMENT_PAGE | userId, name, properties |222| Alias identity | SEGMENT_ALIAS | userId, previousId |223| Source schema | SEGMENT_LIST_SCHEMA_SETTINGS_IN_SOURCE | sourceId |224| Update source | SEGMENT_UPDATE_SOURCE | sourceId |225| Warehouses | SEGMENT_LIST_CONNECTED_WAREHOUSES_FROM_SOURCE | sourceId |226
Full transparency — inspect the skill content before installing.