Create Slack Feed
User Intent
Operation
TypeScript (Canonical)
import { Graphlit } from 'graphlit-client';
import {
ContentTypes,
FeedInput,
FeedListingTypes,
FeedTypes,
SearchTypes,
} from 'graphlit-client/dist/generated/graphql-types';
const graphlit = new Graphlit();
// Optional: Query available Slack channels (requires token/OAuth)
const channelsResponse = await graphlit.querySlackChannels({
token: process.env.SLACK_TOKEN!,
});
console.log('Available channels:', channelsResponse.slackChannels?.results);
// Step 1: Create a Slack feed for ONE channel (one feed per channel)
const feedInput: FeedInput = {
name: 'Engineering Slack',
type: FeedTypes.Slack,
slack: {
type: FeedListingTypes.Past,
channel: 'engineering',
token: process.env.SLACK_TOKEN!,
readLimit: 100,
includeAttachments: true,
},
};
const response = await graphlit.createFeed(feedInput);
const feedId = response.createFeed.id;
console.log(`Slack feed created: ${feedId}`);
// Step 3: Poll for feed completion
while (true) {
const status = await graphlit.isFeedDone(feedId);
if (status.isFeedDone.result) {
break;
}
console.log('Still syncing Slack messages...');
await new Promise((resolve) => setTimeout(resolve, 10_000));
}
console.log('Slack feed sync complete!');Parameters
FeedInput (Required)
SlackFeedPropertiesInput (Required)
Optional
Response
Developer Hints
OAuth Token Requirements
Feed is Continuous Sync
Polling for Initial Sync
Channel Discovery
Variations
1. Sync Specific Channels Only
2. Sync with Auto-Collection
3. Sync with Entity Extraction
4. Query Synced Messages
5. Multi-Channel Pattern with Filtering
Common Issues
Production Example
Last updated