{"_id":"@akson/cortex-slack","_rev":"4-174fa1d92834e10229104d24c12d6ef6","name":"@akson/cortex-slack","dist-tags":{"latest":"2.1.1"},"versions":{"2.0.0":{"name":"@akson/cortex-slack","version":"2.0.0","keywords":["slack","notifications","webhooks","bot","cortex","akson"],"author":{"name":"Cortex Team","email":"cortex@akson.ai"},"license":"MIT","_id":"@akson/cortex-slack@2.0.0","maintainers":[{"name":"antoineschaller","email":"antoine.schaller@akson.ch"}],"homepage":"https://github.com/antoineschaller/cortex-packages/tree/main/packages/@akson/cortex-api-slack","bugs":{"url":"https://github.com/antoineschaller/cortex-packages/issues"},"dist":{"shasum":"deeb77f695737b5774d31ed7a7158ac1163b02ba","tarball":"https://registry.npmjs.org/@akson/cortex-slack/-/cortex-slack-2.0.0.tgz","fileCount":18,"integrity":"sha512-f1GVDJXQv3riXlCuP5e1nNpulWlKO+KXFHJFezFtO2/bWCupsDxKs1U8zzLVRxQo+sHnLCK6NuUJjWOpD3SA4g==","signatures":[{"sig":"MEQCICxqXjUmtiDhMMinyjznFMny6lO5q6nVYw2LdXWi2wjzAiBO2/JklVOvl1Ji0crZ+HBXPMGy9gNqOTobFtxtM3bK4g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":58762},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"b3a6a0832bb2fd230473076bde1bfc7810e9ac31","scripts":{"test":"node dist/test.js","build":"tsc","clean":"rm -rf dist","build:watch":"tsc --watch","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"antoineschaller","email":"antoine.schaller@akson.ch"},"repository":{"url":"git+https://github.com/antoineschaller/cortex-packages.git","type":"git","directory":"packages/@akson/cortex-api-slack"},"_npmVersion":"10.7.0","description":"Unified Slack integration for Cortex ecosystem - webhooks, bot API, and notifications","directories":{},"_nodeVersion":"20.15.1","dependencies":{"@slack/types":"^2.14.0","@slack/web-api":"^7.8.0","@slack/webhook":"^7.0.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/cortex-slack_2.0.0_1757759274540_0.2442413861795414","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Deprecated: replaced by @slack/webhook. No longer maintained."},"2.1.0":{"name":"@akson/cortex-slack","version":"2.1.0","keywords":["slack","notifications","webhooks","bot","cortex","akson"],"author":{"name":"Akson","email":"contact@akson.ch"},"license":"MIT","_id":"@akson/cortex-slack@2.1.0","maintainers":[{"name":"antoineschaller","email":"antoine.schaller@akson.ch"}],"homepage":"https://github.com/antoineschaller/cortex-packages/tree/main/packages/slack","bugs":{"url":"https://github.com/antoineschaller/cortex-packages/issues"},"dist":{"shasum":"851366c359c5c9b26efa0896c45edf75a44fed8f","tarball":"https://registry.npmjs.org/@akson/cortex-slack/-/cortex-slack-2.1.0.tgz","fileCount":22,"integrity":"sha512-FTAxEabj3P7r079mWj+SGWt5pj1kWa4OEkCO/oaWF0n3ycmyaKy/ZcagYb088sdsDuUdxFiz1hPgd0q5wuhBJw==","signatures":[{"sig":"MEQCICRtzl5w+MHhKn7lKnOcuhKkUm6K7yc6amoZAtWD0z27AiB94aosqjcI6Z0GrwWlZBMYHyT9QD/HSjn1IRVKGSfbnQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":72006},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"b3a6a0832bb2fd230473076bde1bfc7810e9ac31","scripts":{"test":"node dist/test.js","build":"tsc","clean":"rm -rf dist","build:watch":"tsc --watch","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"antoineschaller","email":"antoine.schaller@akson.ch"},"repository":{"url":"git+https://github.com/antoineschaller/cortex-packages.git","type":"git","directory":"packages/slack"},"_npmVersion":"11.6.0","description":"Unified Slack integration for Cortex ecosystem - webhooks, bot API, and notifications","directories":{},"_nodeVersion":"24.8.0","dependencies":{"@slack/types":"^2.14.0","@slack/web-api":"^7.8.0","@slack/webhook":"^7.0.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/cortex-slack_2.1.0_1759746303604_0.7805304353257543","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Deprecated: replaced by @slack/webhook. No longer maintained."},"2.1.1":{"name":"@akson/cortex-slack","version":"2.1.1","keywords":["slack","notifications","webhooks","bot","cortex","akson"],"author":{"name":"Akson","email":"contact@akson.ch"},"license":"MIT","_id":"@akson/cortex-slack@2.1.1","maintainers":[{"name":"antoineschaller","email":"antoine.schaller@akson.ch"}],"homepage":"https://github.com/antoineschaller/cortex-packages/tree/main/packages/slack","bugs":{"url":"https://github.com/antoineschaller/cortex-packages/issues"},"dist":{"shasum":"1926c01384c2bafd00c4d9dadfd1f50229d4c2d4","tarball":"https://registry.npmjs.org/@akson/cortex-slack/-/cortex-slack-2.1.1.tgz","fileCount":22,"integrity":"sha512-LidNZ7Z+QbbSaRRhFBJP5LxpA4em8y+T5vEqrpm4iB6QzIr5lK5CzEF7r/gtwgQTSAesGZkg9T9Xxq/xT5koGA==","signatures":[{"sig":"MEUCIAJ2iNkLNNK194gFiivczcxpKE2PORaR3WH6YeebRMoCAiEAwzrgQzhD/ROA8KhvK4OTTFxofJMHVcypxtl4N65g1aU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":72006},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"b3a6a0832bb2fd230473076bde1bfc7810e9ac31","scripts":{"test":"node dist/test.js","build":"tsc","clean":"rm -rf dist","build:watch":"tsc --watch","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"antoineschaller","email":"antoine.schaller@akson.ch"},"repository":{"url":"git+https://github.com/antoineschaller/cortex-packages.git","type":"git","directory":"packages/slack"},"_npmVersion":"11.6.0","description":"Unified Slack integration for Cortex ecosystem - webhooks, bot API, and notifications","directories":{},"_nodeVersion":"24.8.0","dependencies":{"@slack/types":"^2.14.0","@slack/web-api":"^7.8.0","@slack/webhook":"^7.0.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/cortex-slack_2.1.1_1759751302747_0.950328210151872","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Deprecated: replaced by @slack/webhook. No longer maintained."}},"time":{"created":"2025-09-13T10:27:54.445Z","modified":"2026-03-19T11:55:08.056Z","2.0.0":"2025-09-13T10:27:54.736Z","2.1.0":"2025-10-06T10:25:03.807Z","2.1.1":"2025-10-06T11:48:22.957Z"},"bugs":{"url":"https://github.com/antoineschaller/cortex-packages/issues"},"author":{"name":"Akson","email":"contact@akson.ch"},"license":"MIT","homepage":"https://github.com/antoineschaller/cortex-packages/tree/main/packages/slack","keywords":["slack","notifications","webhooks","bot","cortex","akson"],"repository":{"url":"git+https://github.com/antoineschaller/cortex-packages.git","type":"git","directory":"packages/slack"},"description":"Unified Slack integration for Cortex ecosystem - webhooks, bot API, and notifications","maintainers":[{"name":"antoineschaller","email":"antoine.schaller@akson.ch"}],"readme":"# @akson/cortex-slack\n\nUnified Slack integration for the MyArmy ecosystem. Provides centralized notification, alert, and reporting capabilities.\n\n## Features\n\n- 🔔 **Webhook Support** - Simple notifications via Incoming Webhooks\n- 🤖 **Bot API** - Full-featured interactive messages and buttons\n- 🚨 **Alert System** - Severity-based alerts with rich formatting\n- 📊 **Reports** - Daily/weekly intelligence and market reports\n- 🎯 **Lead Tracking** - Real-time lead notifications\n- ⚠️ **Error Handling** - Centralized error notifications\n- 📈 **Metrics** - Performance and threshold alerts\n\n## Installation\n\n```bash\nnpm install @akson/cortex-slack\n```\n\n## Quick Start\n\n### Basic Usage\n\n```typescript\nimport { SlackClient } from '@akson/cortex-slack';\n\nconst slack = new SlackClient({\n  webhookUrl: 'https://hooks.slack.com/services/YOUR/WEBHOOK/URL',\n  botToken: 'xoxb-your-bot-token',\n  channels: {\n    alerts: '#alerts',\n    leads: '#leads',\n    reports: '#reports'\n  }\n});\n\n// Send a simple alert\nawait slack.sendAlert({\n  severity: 'warning',\n  message: 'High memory usage detected',\n  details: {\n    usage: '85%',\n    threshold: '80%'\n  }\n});\n```\n\n### Environment Variables\n\n```bash\n# Webhook (for simple notifications)\nSLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URL\n\n# Bot Token (for full API access)\nSLACK_BOT_TOKEN=xoxb-your-bot-token\nSLACK_APP_ID=your-app-id\nSLACK_TEAM_ID=your-team-id\nSLACK_TEAM_NAME=your-team-name\n\n# Channel Configuration\nSLACK_CHANNEL_ALERTS=#alerts\nSLACK_CHANNEL_TASKS=#tasks\nSLACK_CHANNEL_REPORTS=#reports\nSLACK_CHANNEL_LEADS=#leads\nSLACK_CHANNEL_ERRORS=#errors\n\n# Enable/Disable\nSLACK_ENABLED=true\n```\n\n### Create from Environment\n\n```typescript\nimport { createSlackClientFromEnv } from '@akson/cortex-slack';\n\nconst slack = createSlackClientFromEnv();\n```\n\n## Usage Examples\n\n### Lead Notifications\n\n```typescript\nawait slack.sendLeadNotification({\n  lead_id: 'LEAD-12345',\n  phone: '+41791234567',\n  products: ['Custom Badge', 'Unit Patch'],\n  total_value: 249.90,\n  source: 'WhatsApp',\n  urgency: 'high',\n  timestamp: new Date()\n});\n```\n\n### Error Notifications\n\n```typescript\nawait slack.sendErrorNotification({\n  error: new Error('Database connection failed'),\n  context: 'Lead Processing',\n  severity: 'critical',\n  stack: error.stack,\n  metadata: {\n    lead_id: 'LEAD-12345',\n    retry_count: 3\n  }\n});\n```\n\n### Metric Alerts\n\n```typescript\nawait slack.sendMetricAlert({\n  metric: 'Conversion Rate',\n  current_value: 1.2,\n  threshold: 2.0,\n  change_percentage: -40,\n  trend: 'down',\n  severity: 'warning',\n  recommendation: 'Review landing page changes from last deployment'\n});\n```\n\n### Task Management\n\n```typescript\nawait slack.sendTaskReview({\n  task: {\n    id: 'TASK-001',\n    title: 'Update SEO meta tags',\n    description: 'Optimize meta descriptions for Swiss military keywords',\n    type: 'seo',\n    priority: 'high',\n    confidence: 0.85,\n    estimated_impact: 'High',\n    created_at: new Date()\n  },\n  preview: {\n    suggested_changes: [\n      'Add \"militär badge\" to homepage title',\n      'Update meta description with \"funktionsabzeichen\"'\n    ]\n  },\n  action_required: 'Review and approve SEO changes'\n});\n```\n\n### Daily Intelligence Report\n\n```typescript\nawait slack.sendDailyIntelligenceReport({\n  date: new Date(),\n  sources_checked: 5,\n  tasks_generated: 12,\n  auto_executed: 8,\n  manual_required: 4,\n  swiss_market: {\n    avg_position: 3.2,\n    impressions: 15000,\n    clicks: 450,\n    ctr: 3.0\n  },\n  lead_funnel: {\n    new_leads: 23,\n    conversion_rate: 2.8,\n    whatsapp_contacts: 15\n  },\n  alerts: [\n    'Competitor bidding on brand keywords',\n    'CTR drop on mobile devices'\n  ],\n  recommendations: [\n    'Increase mobile page speed',\n    'Add more Swiss German content'\n  ]\n});\n```\n\n## Integration with MyArmy Intelligence\n\nThis package is designed to work seamlessly with the MyArmy Intelligence system:\n\n```typescript\n// In myarmy-intelligence\nimport { SlackClient } from '@akson/cortex-slack';\n\nconst slack = new SlackClient({\n  botToken: process.env.SLACK_BOT_TOKEN,\n  channels: {\n    alerts: '#intelligence-alerts',\n    tasks: '#intelligence-tasks',\n    reports: '#intelligence-reports'\n  }\n});\n\n// Use for automated alerts\nawait slack.sendAlert({\n  severity: 'critical',\n  message: 'Brand bidding violation detected',\n  details: {\n    competitor: 'Competitor X',\n    keyword: 'myarmy',\n    position: 1\n  }\n});\n```\n\n## Migration Guide\n\n### From Direct Webhook\n\n```typescript\n// Old way\nawait fetch(SLACK_WEBHOOK_URL, {\n  method: 'POST',\n  body: JSON.stringify({ text: 'Hello' })\n});\n\n// New way\nimport { SlackClient } from '@akson/cortex-slack';\nconst slack = new SlackClient({ webhookUrl: SLACK_WEBHOOK_URL });\nawait slack.sendWebhookMessage('Hello');\n```\n\n### From MyArmy Intelligence\n\n```typescript\n// Old way (custom implementation)\nimport { SlackNotifier } from './integrations/slack';\n\n// New way\nimport { SlackClient } from '@akson/cortex-slack';\nconst slack = new SlackClient(config);\n```\n\n## Testing\n\n```typescript\n// Test connection\nconst isConnected = await slack.testConnection();\nconsole.log('Slack connected:', isConnected);\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}