Create Slack Feed
User Intent
"I want to sync Slack channels into Graphlit for search and AI interactions"
Operation
SDK Method:
graphlit.createFeed()with Slack configurationGraphQL:
createFeedmutationEntity Type: Feed
Common Use Cases: Slack channel sync, team communication search, chat history RAG
TypeScript (Canonical)
import { Graphlit } from 'graphlit-client';
import {
ContentTypes,
FeedInput,
FeedListingTypes,
FeedTypes,
SearchTypes,
} from 'graphlit-client/dist/generated/graphql-types';
const graphlit = new Graphlit();
// Step 1: Query available Slack channels (requires OAuth token)
const channelsResponse = await graphlit.querySlackChannels({
token: process.env.SLACK_BOT_TOKEN!,
});
console.log(`Found ${channelsResponse.slackChannels.length} channels`);
// Step 2: Create Slack feed for specific channels
const feedInput: FeedInput = {
name: 'Engineering Slack',
type: FeedTypes.Slack,
slack: {
type: FeedListingTypes.Past,
channel: 'engineering',
token: process.env.SLACK_BOT_TOKEN!,
readMessages: true,
readThreads: true,
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)
name(string): Display name for the feedtype(FeedTypes): Must beSLACKslack(SlackFeedPropertiesInput): Slack-specific configuration
SlackFeedPropertiesInput (Required)
type(FeedServiceTypes):SLACK_CONVERSATIONfor channelstoken(string): Slack OAuth tokenRequires
channels:read,channels:history,groups:read,groups:historyscopesBot token format:
xoxb-...
channels(SlackChannelInput[]): Channels to syncGet channel IDs from
querySlackChannels()
readMessages(boolean): Sync channel messages (recommended: true)readThreads(boolean): Sync message threads (recommended: true)
Optional
correlationId(string): For tracking in productioncollections(EntityReferenceInput[]): Auto-add synced messages to collectionsworkflow(EntityReferenceInput): Apply workflow to messages
Response
Developer Hints
OAuth Token Requirements
Slack OAuth Scopes Needed:
channels:read- List public channelschannels:history- Read public channel messagesgroups:read- List private channels (if needed)groups:history- Read private channel messages (if needed)users:read- Get user information
Getting a Slack Token:
Create Slack App at https://api.slack.com/apps
Add OAuth scopes under "OAuth & Permissions"
Install app to workspace
Copy Bot User OAuth Token (starts with
xoxb-)
Feed is Continuous Sync
Important: Feeds run continuously. To stop syncing, disable or delete the feed.
Polling for Initial Sync
Channel Discovery
Variations
1. Sync Specific Channels Only
Target specific channels by ID:
2. Sync with Auto-Collection
Automatically add messages to a collection:
3. Sync with Entity Extraction
Extract people and topics from messages:
4. Query Synced Messages
Search through synced Slack messages:
5. Multi-Channel Pattern with Filtering
Sync multiple channels and filter by date:
Common Issues
Issue: Invalid token error
Solution: Ensure Slack token has required OAuth scopes. Regenerate token with correct scopes.
Issue: Channel not found
Solution: Use querySlackChannels() to get exact channel IDs. User must have access to the channel.
Issue: Feed created but no messages syncing
Solution: Check readMessages: true is set. Verify token has channels:history scope.
Issue: Missing thread messages
Solution: Ensure readThreads: true is set. Threads are separate from main messages.
Issue: Feed sync taking too long
Solution: This is normal for channels with many messages. Use isFeedDone() to poll. Initial sync can take minutes for large channels.
Production Example
Last updated
Was this helpful?