slack-maxqda-adapter
v2.4.0
Published
Export Slack messages to DOCX and Markdown formats
Maintainers
Readme
Slack Exporter
Export Slack messages to DOCX and Markdown formats.
日本語版 README.ja.md
// Export multiple channels
const multipleResults = await exporter.exportMultiple([
{
channelId: 'C1234567890',
startDate: '2024-04-01',
format: 'docx',
outputPath: './output/channel1.docx',
},
{
channelId: 'C0987654321',
startDate: '2024-04-01',
format: 'md',
outputPath: './output/channel2.md',
},
]);API Reference
const markdownResult = await exporter.export({ channelId: 'C1234567890', startDate: '2024-04-01', format: 'md', outputPath: './output/channel-messages.md', });
// Export multiple channels const multipleResults = await exporter.exportMultiple([ { channelId: 'C1234567890', startDate: '2024-04-01', format: 'docx', outputPath: './output/channel1.docx', }, { channelId: 'C0987654321', startDate: '2024-04-01', format: 'md', outputPath: './output/channel2.md', }, ]);
## API Reference
### SlackMaxqdaAdapter Class
#### Constructor
```typescript
new SlackMaxqdaAdapter(options: SlackMaxqdaAdapterOptions)Options:
token: string- Slack API token (required)concurrency?: number- Number of concurrent processes (default: 4)
Methods
export(options: ExportOptions): Promise<ExportResult>
Export messages from a single channel.
Options:
channelId: string- Channel ID to exportstartDate: string- Start date (YYYY-MM-DD)endDate?: string- End date (YYYY-MM-DD), defaults to startDateformat: 'docx' | 'md'- Output formatoutputPath: string- Output file path
Returns: ExportResult with file path, channel name, message count, and format.
exportMultiple(exports: ExportOptions[]): Promise<ExportResult[]>
Export messages from multiple channels.
getChannelName(channelId: string): Promise<string>
Get channel name by ID.
Types
interface SlackMaxqdaAdapterOptions {
token: string;
concurrency?: number;
}
interface ExportOptions {
channelId: string;
startDate: string;
endDate?: string;
format: 'docx' | 'md';
outputPath: string;
}
interface ExportResult {
filePath: string;
channelName: string;
messageCount: number;
format: 'docx' | 'md';
}Getting Slack API Token
- Visit Slack API Applications
- Create a new app or select an existing one
- Navigate to "OAuth & Permissions"
- Add the following bot token scopes:
channels:readchannels:historygroups:readgroups:historyim:readim:historympim:readmpim:historyusers:readfiles:reademoji:read
- Install the app to your workspace
- Copy the "Bot User OAuth Token"
Getting Channel ID
From Browser
- Open Slack in your browser
- Navigate to the target channel
- The channel ID is in the URL:
https://workspace.slack.com/archives/C1234567890
From Slack App
- Right-click on the channel name
- Select "View channel details"
- The channel ID is shown at the bottom
Development
Setup
git clone https://github.com/your-org/slack-maxqda-adapter.git
cd slack-maxqda-adapter
pnpm installBuild
pnpm buildTest
pnpm testDevelopment with Watch Mode
pnpm build:watchLicense
MIT
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Troubleshooting
Common Errors
- Channel not found: Verify the channel ID and ensure the bot has access to the channel
- Invalid token: Check that your Slack API token is correct and has the required scopes
- Rate limiting: The tool automatically handles rate limits, but you may need to reduce concurrency for very large exports
