Export Slack messages to DOCX and Markdown formats
npm install slack-maxqda-adapterExport Slack messages to DOCX and Markdown formats.
日本語版 README.ja.md
``typescript`
// 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',
},
]);
// 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',
},
]);
`
#### 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
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
Export messages from multiple channels.
##### getChannelName(channelId: string): Promise
Get channel name by ID.
`typescript
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';
}
`
1. Visit Slack API Applications
2. Create a new app or select an existing one
3. Navigate to "OAuth & Permissions"
4. Add the following bot token scopes:
- channels:readchannels:history
- groups:read
- groups:history
- im:read
- im:history
- mpim:read
- mpim:history
- users:read
- files:read
- emoji:read
-
5. Install the app to your workspace
6. Copy the "Bot User OAuth Token"
$3
1. Right-click on the channel name
2. Select "View channel details"
3. The channel ID is shown at the bottomDevelopment
$3
`sh
git clone https://github.com/your-org/slack-maxqda-adapter.git
cd slack-maxqda-adapter
pnpm install
`$3
`sh
pnpm build
`$3
`sh
pnpm test
`$3
`sh
pnpm build:watch
`License
MIT
Contributing
1. Fork the repository
2. Create your feature branch (
git checkout -b feature/amazing-feature)
3. Commit your changes (git commit -m 'Add some amazing feature')
4. Push to the branch (git push origin feature/amazing-feature`)1. Channel not found: Verify the channel ID and ensure the bot has access to the channel
2. Invalid token: Check that your Slack API token is correct and has the required scopes
3. Rate limiting: The tool automatically handles rate limits, but you may need to reduce concurrency for very large exports