{"skill":{"slug":"octolens","displayName":"Octolens","summary":"Query and analyze brand mentions from Octolens API. Use when the user wants to fetch mentions, track keywords, filter by source platforms (Twitter, Reddit, GitHub, LinkedIn, etc.), sentiment analysis, or analyze social media engagement. Supports complex filtering with AND/OR logic, date ranges, follower counts, and bookmarks.","description":"---\nname: octolens\ndescription: Query and analyze brand mentions from Octolens API. Use when the user wants to fetch mentions, track keywords, filter by source platforms (Twitter, Reddit, GitHub, LinkedIn, etc.), sentiment analysis, or analyze social media engagement. Supports complex filtering with AND/OR logic, date ranges, follower counts, and bookmarks.\nlicense: MIT\nmetadata:\n  author: octolens\n  version: \"1.0\"\ncompatibility: Requires Node.js 18+ (for fetch API) and access to the internet\nallowed-tools: Node Read\n---\n\n# Octolens API Skill\n\n## When to use this skill\n\nUse this skill when the user needs to:\n- Fetch brand mentions from social media and other platforms\n- Filter mentions by source (Twitter, Reddit, GitHub, LinkedIn, YouTube, HackerNews, DevTO, StackOverflow, Bluesky, newsletters, podcasts)\n- Analyze sentiment (positive, neutral, negative)\n- Filter by author follower count or engagement\n- Search for specific keywords or tags\n- Query mentions by date range\n- List available keywords or saved views\n- Apply complex filtering logic with AND/OR conditions\n\n## API Authentication\n\nThe Octolens API requires a Bearer token for authentication. The user should provide their API key, which you'll use in the `Authorization` header:\n\n```\nAuthorization: Bearer YOUR_API_KEY\n```\n\n**Important**: Always ask the user for their API key before making any API calls. Store it in a variable for subsequent requests.\n\n## Base URL\n\nAll API endpoints use the base URL: `https://app.octolens.com/api/v1`\n\n## Rate Limits\n\n- **Limit**: 500 requests per hour\n- **Check headers**: `X-RateLimit-*` headers indicate current usage\n\n## Available Endpoints\n\n### 1. POST /mentions\n\nFetch mentions matching keywords with optional filtering. Returns posts sorted by timestamp (newest first).\n\n**Key Parameters:**\n- `limit` (number, 1-100): Maximum results to return (default: 20)\n- `cursor` (string): Pagination cursor from previous response\n- `includeAll` (boolean): Include low-relevance posts (default: false)\n- `view` (number): View ID to use for filtering\n- `filters` (object): Filter criteria (see filtering section)\n\n**Example Response:**\n```json\n{\n  \"data\": [\n    {\n      \"id\": \"abc123\",\n      \"url\": \"https://twitter.com/user/status/123\",\n      \"body\": \"Just discovered @YourProduct - this is exactly what I needed!\",\n      \"source\": \"twitter\",\n      \"timestamp\": \"2024-01-15T10:30:00Z\",\n      \"author\": \"user123\",\n      \"authorName\": \"John Doe\",\n      \"authorFollowers\": 5420,\n      \"relevance\": \"relevant\",\n      \"sentiment\": \"positive\",\n      \"language\": \"en\",\n      \"tags\": [\"feature-request\"],\n      \"keywords\": [{ \"id\": 1, \"keyword\": \"YourProduct\" }],\n      \"bookmarked\": false,\n      \"engaged\": false\n    }\n  ],\n  \"cursor\": \"eyJsYXN0SWQiOiAiYWJjMTIzIn0=\"\n}\n```\n\n### 2. GET /keywords\n\nList all keywords configured for the organization.\n\n**Example Response:**\n```json\n{\n  \"data\": [\n    {\n      \"id\": 1,\n      \"keyword\": \"YourProduct\",\n      \"platforms\": [\"twitter\", \"reddit\", \"github\"],\n      \"color\": \"#6366f1\",\n      \"paused\": false,\n      \"context\": \"Our main product name\"\n    }\n  ]\n}\n```\n\n### 3. GET /views\n\nList all saved views (pre-configured filters).\n\n**Example Response:**\n```json\n{\n  \"data\": [\n    {\n      \"id\": 1,\n      \"name\": \"High Priority\",\n      \"icon\": \"star\",\n      \"filters\": {\n        \"sentiment\": [\"positive\", \"negative\"],\n        \"source\": [\"twitter\"]\n      },\n      \"createdAt\": \"2024-01-01T00:00:00Z\"\n    }\n  ]\n}\n```\n\n## Filtering Mentions\n\nThe `/mentions` endpoint supports powerful filtering with two modes:\n\n### Simple Mode (Implicit AND)\n\nPut fields directly in filters. All conditions are ANDed together.\n\n```json\n{\n  \"filters\": {\n    \"source\": [\"twitter\", \"linkedin\"],\n    \"sentiment\": [\"positive\"],\n    \"minXFollowers\": 1000\n  }\n}\n```\n→ `source IN (twitter, linkedin) AND sentiment = positive AND followers ≥ 1000`\n\n### Exclusions\n\nPrefix any array field with ! to exclude values:\n\n```json\n{\n  \"filters\": {\n    \"source\": [\"twitter\"],\n    \"!keyword\": [5, 6]\n  }\n}\n```\n→ `source = twitter AND keyword NOT IN (5, 6)`\n\n### Advanced Mode (AND/OR Groups)\n\nUse `operator` and `groups` for complex logic:\n\n```json\n{\n  \"filters\": {\n    \"operator\": \"AND\",\n    \"groups\": [\n      {\n        \"operator\": \"OR\",\n        \"conditions\": [\n          { \"source\": [\"twitter\"] },\n          { \"source\": [\"linkedin\"] }\n        ]\n      },\n      {\n        \"operator\": \"AND\",\n        \"conditions\": [\n          { \"sentiment\": [\"positive\"] },\n          { \"!tag\": [\"spam\"] }\n        ]\n      }\n    ]\n  }\n}\n```\n→ `(source = twitter OR source = linkedin) AND (sentiment = positive AND tag ≠ spam)`\n\n### Available Filter Fields\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `source` | string[] | Platforms: twitter, reddit, github, linkedin, youtube, hackernews, devto, stackoverflow, bluesky, newsletter, podcast |\n| `sentiment` | string[] | Values: positive, neutral, negative |\n| `keyword` | string[] | Keyword IDs (get from /keywords endpoint) |\n| `language` | string[] | ISO 639-1 codes: en, es, fr, de, pt, it, nl, ja, ko, zh |\n| `tag` | string[] | Tag names |\n| `bookmarked` | boolean | Filter bookmarked (true) or non-bookmarked (false) posts |\n| `engaged` | boolean | Filter engaged (true) or non-engaged (false) posts |\n| `minXFollowers` | number | Minimum Twitter follower count |\n| `maxXFollowers` | number | Maximum Twitter follower count |\n| `startDate` | string | ISO 8601 format (e.g., \"2024-01-15T00:00:00Z\") |\n| `endDate` | string | ISO 8601 format |\n\n## Using the Bundled Scripts\n\nThis skill includes helper scripts for common operations. Use them to quickly interact with the API:\n\n### Fetch Mentions\n```bash\nnode scripts/fetch-mentions.js YOUR_API_KEY [limit] [includeAll]\n```\n\n### List Keywords\n```bash\nnode scripts/list-keywords.js YOUR_API_KEY\n```\n\n### List Views\n```bash\nnode scripts/list-views.js YOUR_API_KEY\n```\n\n### Custom Filter Query\n```bash\nnode scripts/query-mentions.js YOUR_API_KEY '{\"source\": [\"twitter\"], \"sentiment\": [\"positive\"]}' [limit]\n```\n\n### Advanced Query\n```bash\nnode scripts/advanced-query.js YOUR_API_KEY [limit]\n```\n\n## Best Practices\n\n1. **Always ask for the API key** before making requests\n2. **Use views** when possible to leverage pre-configured filters\n3. **Start with simple filters** and add complexity as needed\n4. **Check rate limits** in response headers (`X-RateLimit-*`)\n5. **Use pagination** with cursor for large result sets\n6. **Dates must be ISO 8601** format (e.g., \"2024-01-15T00:00:00Z\")\n7. **Get keyword IDs** from `/keywords` endpoint before filtering by keyword\n8. **Use exclusions** (!) to filter out unwanted content\n9. **Combine includeAll=false** with relevance filtering for quality results\n\n## Common Use Cases\n\n### Find positive Twitter mentions with high followers\n```json\n{\n  \"limit\": 20,\n  \"filters\": {\n    \"source\": [\"twitter\"],\n    \"sentiment\": [\"positive\"],\n    \"minXFollowers\": 1000\n  }\n}\n```\n\n### Exclude spam and get Reddit + GitHub mentions\n```json\n{\n  \"limit\": 50,\n  \"filters\": {\n    \"source\": [\"reddit\", \"github\"],\n    \"!tag\": [\"spam\", \"irrelevant\"]\n  }\n}\n```\n\n### Complex query: (Twitter OR LinkedIn) AND positive sentiment, last 7 days\n```json\n{\n  \"limit\": 30,\n  \"filters\": {\n    \"operator\": \"AND\",\n    \"groups\": [\n      {\n        \"operator\": \"OR\",\n        \"conditions\": [\n          { \"source\": [\"twitter\"] },\n          { \"source\": [\"linkedin\"] }\n        ]\n      },\n      {\n        \"operator\": \"AND\",\n        \"conditions\": [\n          { \"sentiment\": [\"positive\"] },\n          { \"startDate\": \"2024-01-20T00:00:00Z\" }\n        ]\n      }\n    ]\n  }\n}\n```\n\n## Error Handling\n\n| Status | Error | Description |\n|--------|-------|-------------|\n| 401 | unauthorized | Missing or invalid API key |\n| 403 | forbidden | Valid key but no permission |\n| 404 | not_found | Resource (e.g., view ID) not found |\n| 429 | rate_limit_exceeded | Too many requests |\n| 400 | invalid_request | Malformed request body |\n| 500 | internal_error | Server error, retry later |\n\n## Step-by-Step Workflow\n\nWhen a user asks to query Octolens data:\n\n1. **Ask for API key** if not already provided\n2. **Understand the request**: What are they looking for?\n3. **Determine filters needed**: Source, sentiment, date range, etc.\n4. **Check if a view applies**: List views first if user mentions saved filters\n5. **Build the query**: Use simple mode first, advanced mode for complex logic\n6. **Execute the request**: Use bundled Node.js scripts or fetch API directly\n7. **Parse results**: Extract key information (author, body, sentiment, source)\n8. **Handle pagination**: If more results needed, use cursor from response\n9. **Present findings**: Summarize insights, highlight patterns\n\n## Examples\n\n### Example 1: Simple Query\n**User**: \"Show me positive mentions from Twitter in the last 7 days\"\n\n**Action** (using bundled script):\n```bash\nnode scripts/query-mentions.js YOUR_API_KEY '{\"source\": [\"twitter\"], \"sentiment\": [\"positive\"], \"startDate\": \"2024-01-20T00:00:00Z\"}'\n```\n\n**Alternative** (using fetch API directly):\n```javascript\nconst response = await fetch('https://app.octolens.com/api/v1/mentions', {\n  method: 'POST',\n  headers: {\n    'Authorization': `Bearer ${API_KEY}`,\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\n    limit: 20,\n    filters: {\n      source: ['twitter'],\n      sentiment: ['positive'],\n      startDate: '2024-01-20T00:00:00Z',\n    },\n  }),\n});\nconst data = await response.json();\n```\n\n### Example 2: Advanced Query\n**User**: \"Find mentions from Reddit or GitHub, exclude spam tag, with positive or neutral sentiment\"\n\n**Action** (using bundled script):\n```bash\nnode scripts/query-mentions.js YOUR_API_KEY '{\"operator\": \"AND\", \"groups\": [{\"operator\": \"OR\", \"conditions\": [{\"source\": [\"reddit\"]}, {\"source\": [\"github\"]}]}, {\"operator\": \"OR\", \"conditions\": [{\"sentiment\": [\"positive\"]}, {\"sentiment\": [\"neutral\"]}]}, {\"operator\": \"AND\", \"conditions\": [{\"!tag\": [\"spam\"]}]}]}'\n```\n\n**Alternative** (using fetch API directly):\n```javascript\nconst response = await fetch('https://app.octolens.com/api/v1/mentions', {\n  method: 'POST',\n  headers: {\n    'Authorization': `Bearer ${API_KEY}`,\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\n    limit: 30,\n    filters: {\n      operator: 'AND',\n      groups: [\n        {\n          operator: 'OR',\n          conditions: [\n            { source: ['reddit'] },\n            { source: ['github'] },\n          ],\n        },\n        {\n          operator: 'OR',\n          conditions: [\n            { sentiment: ['positive'] },\n            { sentiment: ['neutral'] },\n          ],\n        },\n        {\n          operator: 'AND',\n          conditions: [\n            { '!tag': ['spam'] },\n          ],\n        },\n      ],\n    },\n  }),\n});\nconst data = await response.json();\n```\n\n### Example 3: Get Keywords First\n**User**: \"Show mentions for our main product keyword\"\n\n**Actions**:\n1. First, list keywords:\n```bash\nnode scripts/list-keywords.js YOUR_API_KEY\n```\n\n2. Then query mentions with the keyword ID:\n```bash\nnode scripts/query-mentions.js YOUR_API_KEY '{\"keyword\": [1]}'\n```\n\n## Tips for Agents\n\n- **Use bundled scripts**: The Node.js scripts handle JSON parsing automatically\n- **Cache keywords**: After fetching keywords once, remember them for the session\n- **Explain filters**: When using complex filters, explain the logic to the user\n- **Show examples**: When users are unsure, show example filter structures\n- **Paginate wisely**: Ask if user wants more results before fetching next page\n- **Summarize insights**: Don't just dump data, provide analysis (sentiment trends, top authors, platform distribution)\n","tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":3129,"installsAllTime":118,"installsCurrent":7,"stars":4,"versions":1},"createdAt":1769438724919,"updatedAt":1778485857338},"latestVersion":{"version":"1.0.0","createdAt":1769438724919,"changelog":"Octolens 1.0.0 – Initial Release\n\n- Query and analyze brand mentions from the Octolens API across platforms like Twitter, Reddit, GitHub, LinkedIn, and more.\n- Filter mentions by source, sentiment, follower count, engagement, date range, tags, and complex AND/OR logic.\n- Support for keyword tracking, bookmarks, and advanced filtering (including exclusions).\n- List available keywords and saved views for streamlined queries.\n- Includes ready-to-use Node.js scripts for common API operations and custom queries.\n- Requires user-supplied API key (Bearer token) for authentication.","license":null},"metadata":null,"owner":{"handle":"garrrikkotua","userId":"s177t2jm113g45xfvbvatxw8sd8848d9","displayName":"garrrikkotua","image":"https://avatars.githubusercontent.com/u/36304232?v=4"},"moderation":null}